本地计算机上的服务启动然后停止,某些服务如果没有被其他服务或程序使用则自动停止

2024-05-08

我创建了一个示例 Windows 服务并成功安装了我的服务。但是在要启动服务时。我收到以下错误。

本地计算机上的此服务启动然后停止。 如果其他服务或程序未使用某些服务,则会自动停止

我的配置文件代码:

<system.serviceModel>
    <services>
      <service name="SvcClient.WCFJobsLibrary.Service1">
        <endpoint address="" binding="wsHttpBinding" contract="WCFJobsLibrary.IService1">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8732/Design_Time_Addresses/WCFJobsLibrary/Service1/" />
          </baseAddresses>
        </host>
      </service>
 </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, 
          set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="True"/>
          <!-- 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 -->
          <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

有谁可以建议我吗... 提前致谢。


您需要指定服务的端点(客户端可以访问该服务的 URI)。

您可以在实例化的代码中执行此操作ServiceHost(一个非常通用的例子):

ServiceHost myHost = new ServiceHost(typeof(TechResponse), new Uri("http://www.somedomain.com/TechResponse"));
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

本地计算机上的服务启动然后停止,某些服务如果没有被其他服务或程序使用则自动停止 的相关文章

随机推荐