开发者

How to setup WCF Net.Tcp

I'm trying to setup a wcf service to use net.tcp over I开发者_高级运维IS 7.

Here is the error I get:

There was no endpoint listening at net.tcp://127.0.0.1:8000/ListingService that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

Here is the code I call from the client:

using (var client = new ListingServiceClient("NetTcpBinding"))
{
   client.Test();
   client.Close();
}

Here is my services 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>

And here is my client 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>

Any ideas?


This configuration will not work in IIS/WAS. When hosting in IIS you need .svc file (or configuration based activation in WCF 4) and address of the endpoint is always VirtualDirectoryPath + SvcFile + Relative address specified in endpoint configuration. Setting absolute address in endpoint configuration is for self hosting.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜