Reputation: 2052
I have a .NET MVC web app and a Windows Service running on the same machine. Both projects use the same database through a different Data Access Layer project.
I need the Windows Service to perform some actions on the database, and i know there are different options, just want to know which is the correct:
1.- Calling an Action on the .NET MVC web app that also performs the same actions needed by the Windows Service. To do so i would call the Action with a standard "HttpWebRequest" call.
2.- Creating a Web API controller on the .NET MVC web app and calling it from the Windows Service using the WebApi.Client library.
3.- Creating a new WCF project to create a new service and calling it from the Windows Service.
I'm not familiar with any of the options above, so please feel free to post the correct way to do it.
Upvotes: 0
Views: 861
Reputation: 63
How about creating a class library with the code you want to run and use it in both the web app and the service? I call that option 4.
Upvotes: 1