Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot start host WCF service
    primarykey
    data
    text
    <p>i followed this guide and build WCF project:</p> <p><a href="http://msdn.microsoft.com/en-us/library/ff649818.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ff649818.aspx</a></p> <p>My client connect successfully from local and from remote machine and all this while run wcf service from Visual studio. After install the service on the machine and try to start the service (from services.msc) the service not started and received an error while try to start the service: </p> <pre><code>service on local computer started and stopped. some services stop automatically if they are not used by other services </code></pre> <p>This is my On <code>Service1.cs</code> from <code>WindowsService project</code>:</p> <pre><code>using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Linq; using System.ServiceProcess; using System.Text; using System.ServiceModel; using WcfServiceLibrary1; namespace WindowsService1 { public partial class Service1: ServiceBase { internal static ServiceHost myServiceHost = null; public WCFServiceHost1() { InitializeComponent(); } protected override void OnStart(string[] args) { if (myServiceHost != null) { myServiceHost.Close(); } myServiceHost = new ServiceHost(typeof(Service1)); myServiceHost.Open(); } protected override void OnStop() { if (myServiceHost != null) { myServiceHost.Close(); myServiceHost = null; } } } } </code></pre> <p>This is from windows Event Viewer:</p> <pre><code>The description for Event ID 0 from source Service1 cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer. If the event originated on another computer, the display information had to be saved with the event. The following information was included with the event: Service cannot be started. System.InvalidOperationException: The HttpGetEnabled property of ServiceMetadataBehavior is set to true and the HttpGetUrl property is a relative address, but there is no http base address. Either supply an http base address or set HttpGetUrl to an absolute address. at System.ServiceModel.Description.ServiceMetadataBehavior.CreateHttpGetEndpoints(ServiceDescription description, ServiceHostBase host, ServiceMetadataExtension mex) at System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost) at System.ServiceModel.ServiceHostBase.InitializeRuntime() at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at WindowsService1.Service1.OnStart(String[] args) in d:\WCFService\WindowsService1\Service1.cs:line 30 at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state) </code></pre> <p>App.config:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;configuration&gt; &lt;system.web&gt; &lt;compilation debug="true" /&gt; &lt;/system.web&gt; &lt;!-- When deploying the service library project, the content of the config file must be added to the host's app.config file. System.Configuration does not support config files for libraries. --&gt; &lt;system.serviceModel&gt; &lt;services&gt; &lt;service name="WCFService.Service1"&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress = "http://localhost:8733/Service1/" /&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;!-- Service Endpoints --&gt; &lt;!-- Unless fully qualified, address is relative to base address supplied above --&gt; &lt;endpoint address="" binding="basicHttpBinding" contract="WCFService.IService1"&gt; &lt;!-- Upon deployment, the following identity element should be removed or replaced to reflect the identity under which the deployed service runs. If removed, WCF will infer an appropriate identity automatically. --&gt; &lt;identity&gt; &lt;dns value="localhost"/&gt; &lt;/identity&gt; &lt;/endpoint&gt; &lt;!-- Metadata Endpoints --&gt; &lt;!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. --&gt; &lt;!-- This endpoint does not use a secure binding and should be secured or removed before deployment --&gt; &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/&gt; &lt;/service&gt; &lt;/services&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior&gt; &lt;!-- To avoid disclosing metadata information, set the value below to false before deployment --&gt; &lt;serviceMetadata httpGetEnabled="True"/&gt; &lt;!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --&gt; &lt;serviceDebug includeExceptionDetailInFaults="False" /&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;/system.serviceModel&gt; &lt;/configuration&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload