0

I'm going from Java to C# / Asp.NET for a project. As far as I can see the syntax is very close to java. But I have a few questions to get me starting. I want to create a web-page as a front end. This front end should be able to upload files, when a new file upload is initiated a local application takes over, processing the file trough several different programs.

But I'm a bit confused as to how I will achieve communication between the local "control program" and the web-page running on the webserver. The application will run on the same machine as the web-server. But how would you go about communication between the application and the web-server?

User uploads a file from website -> (Website notifies local app that a new file is added (this is the confusing part) -> Processes the file and sends a confirmation to the webpage / database once it's done.

I just need something to start reading. So any help is appreciated.

chriskvik
  • 1,281
  • 2
  • 10
  • 32
  • It looks like you've answered your own question - start reading... So far your question is offtopic as ether "searching for links/tools" or duplicate of many "how to run executable from ASP.Net pages". – Alexei Levenkov Jan 09 '14 at 18:28
  • Yes, pick up a good book on ASP.NET MVC. Then, have a look at this thread: http://stackoverflow.com/questions/5193842 – Dave Clausen Jan 09 '14 at 18:30
  • `As far as I can see the syntax is very close to java` - that was true 10 years ago. `C#` has [evolved](http://en.wikipedia.org/wiki/Language_Integrated_Query) since then. – Federico Berasategui Jan 09 '14 at 18:31

1 Answers1

2

First background information about how ASP.net and IIS work (i might be off by a bit). Per request IIS generates a thread on a worker process. Once the worker process request thread completes its work it is disposed. So if you spawned an application to do something from asp.net async, once the request was completed. That application would be closed, it does not matter if it completed its task or not. If you were to spawn an application synchronously, you would never need a local app, the requeset would wait until it completed its task and closed, then it would proceed to complete the web request.

So you can have the local app monitor something like a folder or a database for changes, do its thing and then update a central data store where asp.net can check if it was completed. Once it is completed update the front-end. (probably ajax or signalR to check for changes)

When doing things like what you are wanting to do. It is a good Idea to decouple the app from the website and write them so they can operate on their own. So Asp.net has no dependencies on the local app and vice versa. But they can share a dependency such as a databse or a network share. This way you can move the website around and the app around with out any problems. Also you will reduce security risks by not having to give the asp.net user elevated permissions to execute a different application etc. (this is just a thought)

Some similar questions:

Two-way communication between ASP.NET Web App and C# Application

How to communicate between ASP.NET & C# Application

Community
  • 1
  • 1