使用TCP在Windows服务中托管WCF

时间:2011-10-03 11:22:44

标签: wcf service tcp

我正在尝试在Windows 2008 x64上的Windows服务中托管wcf服务(tcp)。

我首先作为主持人制作了一个正常程序,并且工作正常。

然后我使用相同的配置制作了一个Windows服务:
http://msdn.microsoft.com/en-us/library/ff649818.aspx

安装好的服务器启动没有问题,但我无法连接到它。
我认为该程序没有加载配置文件(exename.config),因为myServiceHost.BaseAddresses为空。

知道什么可能导致这个或如何找到错误?

这是我的配置:

<?xml version="1.0"?>

<configuration>

  <system.web>
    <compilation debug="false" />
  </system.web>
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="SlmWcfServiceLibrary.Service1Behavior" name="SlmWcfServiceLibrary.SlmService">
    <endpoint address="" binding="netTcpBinding" bindingConfiguration="" contract="SlmWcfServiceLibrary.ISlmService">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://localhost:9999/Service1/" />
      </baseAddresses>
    </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
    <behavior name="SlmWcfServiceLibrary.Service1Behavior">
      <serviceMetadata httpGetEnabled="False" />
      <serviceDebug includeExceptionDetailInFaults="False" />
    </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

  <startup></startup>
</configuration>

0 个答案:

没有答案