|
-
Apr 5th, 2023, 07:46 AM
#1
Thread Starter
Addicted Member
Communicating between ASP.net web app and windows form app
Hi
I'm in need of some advice please on what level of communication can be achieved between an ASP.net app (run as localhost) and a windows form app.
In general terms:
1. I have a windows form app, the form having various option buttons the user can select and then essentially a 'Go' button that runs a process and then reports back results to labels on the form. This all works fine, but I've been asked if the user can do the options and start the process off from a browser web page.
2. So I thought the way to do this would be to create a localhost ASP.net form which mimics the look of the windows form app - ie it takes the options selected on the ASP.net form and then starts up the windows form app. I imagine I can use launch parameters to contain the options when I call the windows form app, so the vb form knows what options to use.
3. The windows form app usually has a label showing progress, which is essentially just a counter incremented on a loop, so I need a way of getting this information back to the web page, along with a simple bit of text in a label to report when the form is finished.
I understand I need to use WCF services to communicate between the ASP.net form and the windows form, but I'm having problems finding good examples of this to follow online.
Can anyone advise if this is even the right way to approach this sort of requirement, and if so provide any pointers as to how I might go about setting it up?
Thanks
-
Apr 5th, 2023, 08:05 AM
#2
Re: Communicating between ASP.net web app and windows form app
You haven't explained what the Windows Form app is doing. But based on your description, my recommendation would be to discard your plans to marionette the Windows Forms app from an ASP.NET page, and just code the ASP.NET page to perform the exact same tasks that the Windows Forms app does. Most of the code can probably be copy/pasted from the Forms app to the ASP.NET page with little to no changes.
-
Apr 5th, 2023, 09:10 AM
#3
Thread Starter
Addicted Member
Re: Communicating between ASP.net web app and windows form app
 Originally Posted by OptionBase1
You haven't explained what the Windows Form app is doing. But based on your description, my recommendation would be to discard your plans to marionette the Windows Forms app from an ASP.NET page, and just code the ASP.NET page to perform the exact same tasks that the Windows Forms app does. Most of the code can probably be copy/pasted from the Forms app to the ASP.NET page with little to no changes.
Hi thanks for replying
I didn't want to muddy things by going into it in too much detail on what the windows form app does - it's a bunch of operations on existing pdf files. The pdfs are filed in a directory with separate files for separate days (hence the need for the user to be able to select some options to get the required day). The app sorts the pdfs in various ways, n-ups them, stamps some barcodes on, combines them into an output file and so on, all using itext7. It all works as I need it to, so the problem for me is just getting a web form to tell it to start up with the required options as to date (ie folders) required.
Regarding your idea of just replacing the form app and putting the code into the ASP.net page - I had thought of that, and this still might be a fall-back. It would defintely seem easier than running them separately.
However I thought that while it only needs to be localhost at the moment, there might be a requirement in the future to host the ASP.net in the cloud, so I thought I might be best to just separate things from the outset?
Also, in the past I've used simple text files as a means to communicate between different vb programs for some tasks - ie one form writes to the file, the other reads it. As this seems very primitive though, I thought I might be able to use methods learned with this 'ASP.net/windows form app communication' exercise in other areas as well.
-
Apr 5th, 2023, 09:19 AM
#4
Re: Communicating between ASP.net web app and windows form app
I'd move the processing logic to the server ... then rewire the desktop app to call the processor on the server instead of doing it locally. Then build the web page to do the same ...then you have the best of both ... and one place of record for the actual processing. No strings, no marionettes, no smoke, no mirrors.
-tg
-
Apr 5th, 2023, 09:38 AM
#5
Thread Starter
Addicted Member
Re: Communicating between ASP.net web app and windows form app
OK, sounds logical, so we're back to my original query: what's the easiest way to communicate between desktop app/server and ASP.net/server?
For example, a progress indicator - which could be as simple as a label which says something like '134 files processed out of 785'
I've been looking through some WCF service stuff online and I can't get my head around it
-
Apr 5th, 2023, 09:55 AM
#6
Re: Communicating between ASP.net web app and windows form app
 Originally Posted by Precision999
OK, sounds logical, so we're back to my original query: what's the easiest way to communicate between desktop app/server and ASP.net/server?
For example, a progress indicator - which could be as simple as a label which says something like '134 files processed out of 785'
I've been looking through some WCF service stuff online and I can't get my head around it 
DON'T DO WCF!
JUST DON'T!
U can use a web api aka rest service to call either from an app of asp, provided that it's on a stable server somewhere.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Apr 5th, 2023, 10:35 AM
#7
Thread Starter
Addicted Member
Re: Communicating between ASP.net web app and windows form app
 Originally Posted by sapator
DON'T DO WCF!
JUST DON'T!
OK, OK, I believe you!!!
Seriously though, not using WCF is welcome advice! - I'll do some research on the web api option.
Thanks
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|