Click here to Skip to main content
15,067,335 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,
I am getting the following error ' The MYWidowsService service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs.' when I try to start the wcf service hosted as Windows service .

The following is the code in onstart() of windows service

if (m_Host != null)
{
m_Host.Close();
}
Uri httpUrl = new Uri("http://localhost:8090/MyService/SimpleWindowsService");
m_Host = new ServiceHost(typeof(MYWCF.Service1), httpUrl);

m_Host.AddServiceEndpoint(typeof(MYWCF.IService1), new WSHttpBinding(), "");
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
m_Host.Description.Behaviors.Add(smb);
m_Host.Open();

Please give me the solution.

Thanks an advance.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900