I\'m a C#, ASP.NET newbie.
Let\'s say I have an existing C# project (from a \"Console Application\" template; I work with Visual Studio). I want to be able to start a si
Here is a good article on this: http://msdn.microsoft.com/en-us/library/aa529311.aspx
The key is the usage of the Microsoft.Web.Services3
Sample code copied from the linked article:
public partial class WindowsServiceToHostASMXWebService : ServiceBase
{
protected override void OnStart(string[] args)
{
Uri address = new Uri("soap.tcp://localhost/TestService");
SoapReceivers.Add(new EndpointReference(address), typeof(Service ));
}
protected override void OnStop()
{
SoapReceivers.Clear();
}
}
and calling it:
static void Main()
{
System.ServiceProcess.ServiceBase[] ServicesToRun;
// Change the following line to match.
ServicesToRun = new System.ServiceProcess.ServiceBase[] { new WindowsServiceToHostASMXWebService() };
System.ServiceProcess.ServiceBase.Run(ServicesToRun);
}