Windows服务元数据

时间:2017-01-17 14:44:56

标签: c# windows-services metadata

我正在运行具有以下配置的控制台应用程序

<system.serviceModel>
<services>
  <service name="FileBetService.Service">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="LargeMessageBinding" contract="FileBetService.IService"/>
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8000/FileBet"/>
      </baseAddresses>
    </host>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <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="True"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <basicHttpBinding>
    <binding name="LargeMessageBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" closeTimeout="00:15:00" openTimeout="00:15:00" receiveTimeout="00:15:00" sendTimeout="00:15:00">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
    </binding>
  </basicHttpBinding>
</bindings>

服务正常运行但是当我创建具有相同配置的Windows服务时,它会在打开主机时抛出以下异常:

        _host = new ServiceHost(typeof(Service));
        _host.Open();

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.

任何帮助都会很棒。

0 个答案:

没有答案