如何设置WCF Net.Tcp

Jus*_*tin 1 wcf nettcpbinding

我正在尝试设置一个wcf服务,以便在IIS 7上使用net.tcp.

这是我得到的错误:

在net.tcp://127.0.0.1:8000/ListingService中没有可以接受该消息的端点监听.这通常是由错误的地址或SOAP操作引起的.有关更多详细信息,请参阅InnerException(如果存在).

这是我从客户端调用的代码:

using (var client = new ListingServiceClient("NetTcpBinding"))
{
   client.Test();
   client.Close();
}
Run Code Online (Sandbox Code Playgroud)

这是我的服务web.config - http://pastebin.com/3S8BZbup

<system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding portSharingEnabled="true">
          <security mode="None" />
        </binding>
      </netTcpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="default">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <!--throttle service-->
          <serviceThrottling
            maxConcurrentCalls="10000"
            maxConcurrentSessions="10000" 
            maxConcurrentInstances="10000" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service behaviorConfiguration="default" name="Housters.Services.ListingService">
        <endpoint name="TcpEndpoint"
                  address="net.tcp://127.0.0.1:8000/ListingService"
                  binding="netTcpBinding"
                  contract="Housters.Services.IListingService" />
      </service>
    </services>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
      <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
Run Code Online (Sandbox Code Playgroud)

这是我的客户端app.config - http://pastebin.com/YpiAhh46

<system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="NetTcpBinding">
          <security mode="None"/>
        </binding>
      </netTcpBinding>
    </bindings>
    <client>
      <endpoint
              address="net.tcp://127.0.0.1:8000/ListingService"
              binding="netTcpBinding" bindingConfiguration="NetTcpBinding"
              contract="ListingServiceProxy.IListingService" name="NetTcpBinding" />
    </client>
  </system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

Lad*_*nka 7

此配置在IIS/WAS中不起作用.在IIS中托管时,您需要.svc文件(或WCF 4中基于配置的激活),并且端点的地址始终是在端点配置中指定的VirtualDirectoryPath + SvcFile +相对地址.在端点配置中设置绝对地址用于自托管.