Can't Access Net TCP service From WCF Test Client

前端 未结 3 449
长发绾君心
长发绾君心 2021-01-23 05:31

I\'m trying to run two WCF services from within IIS one is a web service and one is a Net TCP Binding Service.

Here is a simulcrum of my Web.config (I\'ve anonymized the

相关标签:
3条回答
  • 2021-01-23 05:47

    just try to keep this as it is, and changing your service inside and paste it inside your config file, it should work perfectly. to test the net.tcp you can use SvcUtil.exe

           <system.serviceModel>
    <services>
      <service name="MyWCFServices.HelloWorldService">
        <endpoint
             binding="netTcpBinding"
             bindingConfiguration="ultra"
             contract="MyWCFServices.IHelloWorldService"/>
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"  />
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:8086/HelloWorldService.svc" />
            <add baseAddress="http://localhost:8081/HelloWorldService.svc" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <bindings>
      <netTcpBinding>
        <binding name="ultra"
             maxBufferPoolSize="2147483647"
             maxBufferSize="2147483647"
             maxReceivedMessageSize="2147483647"
             portSharingEnabled="false"
             transactionFlow="false"
             listenBacklog="2147483647" >
          <security mode="None">
            <message clientCredentialType="None"/>
            <transport protectionLevel="None" clientCredentialType="None"/>
          </security>
          <reliableSession enabled="false"/>
        </binding>
      </netTcpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    </system.serviceModel>
    
    0 讨论(0)
  • 2021-01-23 05:57

    For the HTTP endpoint, you need to reconfigure the Project Properties so that it starts your web.config defined endpoint at port 8523 if hosted using IIS Express. Use specific port (8523) instead of auto-assigned port (51953).

    For the TCP metadata, you need to support a TCP-enabled mex endpoint (mexTcpBinding).

    <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
    
    0 讨论(0)
  • 2021-01-23 05:59

    The net.tcp and HTTP bindings must be set on different ports on IIS. It can be tested with the same port or different. It will crash in the first case. Also, you can use whatever port numbers you want. In this case, the TCP port can be changed to 8524. It's just that you cannot use two separate protocols on the same port. On the other hand, the base addresses make sense only for self-hosted services. Here the base address is determined by the URL from IIS.

    0 讨论(0)
提交回复
热议问题