1

I already have a Windows Service project that runs scheduled tasks as part of a larger application. I want to add some Web Services to it (i.e. SOAP), so that some .NET clients can connect and request services (this is all on a LAN, not over the internet). The server application is a Service Project with references to some class library projects.

Is this something that can be done, or does the web service require that I create an ASP.NET project? Sorry for the very basic question, but I'm not sure where to start.

Scott Whitlock
  • 13,739
  • 7
  • 65
  • 114
  • 1
    Yes, it can be done. No need for ASP.Net. See for ex. *ServiceHost* or *WebServiceHost* of WCF – EZI Mar 05 '15 at 21:03
  • After posting the question, SO then suggested [this related question](http://stackoverflow.com/questions/1013896/is-it-possible-to-create-a-standalone-c-sharp-web-service-deployed-as-an-exe-or?rq=1) which may, in fact, answer my question. I will have to spend some time reading the links over there first before I'm sure. It was not my intention to create a duplicate. – Scott Whitlock Mar 05 '15 at 21:06
  • And another example http://stackoverflow.com/questions/12899360/getting-a-post-endpoint-to-work-in-self-hosted-webservicehost-c-sharp-webservi – EZI Mar 05 '15 at 21:11
  • See http://www.asp.net/web-api/overview/hosting-aspnet-web-api/use-owin-to-self-host-web-api (for Web API, I'd go with it) – abatishchev Mar 05 '15 at 21:13
  • and https://msdn.microsoft.com/en-us/library/ms731758%28v=vs.110%29.aspx (for WCF) – abatishchev Mar 05 '15 at 21:13

2 Answers2

0

You can create a new WCF service without creating an APS.NET webservice and you can use SOAP to communicate with it.

Maybe this MSDN link can help you more.

Gergo Bogdan
  • 199
  • 1
  • 5
0

The answer is that a Windows Service can "self host" WCF WebServices using the ServiceHost class.

Relevant article: Hosting and Consuming WCF Services.

Specific section: Hosting in Windows Services.

Scott Whitlock
  • 13,739
  • 7
  • 65
  • 114