Powered by Blogger.

Sunday, February 16, 2014

The Service on local computer started and then stopped, Some services stop automatically if there are not in use by other services or programs



I got the below error when trying to start a wcf service. The full error message is:

The Service on local computer started and then stopped,Some services stop automatically if there are not in use by other services or programs.

Cause:
I faced this issue in a WCF application. I have installed the WCF as an windows service.

In the endpoint I put that as binding="netTcpBinding". But in the base address I was defining as below:

<baseAddresses>
    <add baseAddress="http://localhost:8732/Design_Time_Addresses/MyTestWCF/Service1/"/>

  </baseAddresses>

Solution:
I changed the base address to net.tcp and it worked for me.

So my new baseAddresses is like below:
<baseAddresses>
    <add baseAddress="net.tcp://localhost:8732/Design_Time_Addresses/MyTestWCF/Service1/"/>
  </baseAddresses>

And my end point is like below:
<endpoint name="NetTcpEndPoint" address="" binding="netTcpBinding" contract="MyTestWCF.IService1"/>

Also check in  <behaviors> section. Inside <serviceBehaviors> the below line should be false.

<serviceMetadata httpGetEnabled="False"/>

Now its working for me.

Also you can check out my previous posts on:

- Read and write from Text file in Asp.Net

- Caching in Asp.Net

- How to optimize session state in asp.net?



0 comments

Post a Comment