IIS 7 上 net.tcp WCF 服务(mex 端点)的“找不到兼容的 TransportManager”错误

Sir*_*lly 2 .net wcf net.tcp

我使用以下配置创建了服务

<system.serviceModel>

<bindings>
  <netTcpBinding>

    <binding name="CommonUserNameBinding" maxConnections="1000" portSharingEnabled="True">
      <security mode="None">
      </security>
    </binding>

  </netTcpBinding>

</bindings>


<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

<services>
  <service name="MyNameSpace.SimplePluginService" behaviorConfiguration="CommonBehavior">

    <endpoint address="UserName"
              binding="netTcpBinding" 
              bindingConfiguration="CommonUserNameBinding" 
              name="MyNameSpace.Contracts.ISimplePluginServiceUserName" 
              contract="MyNameSpace.Contracts.ISimplePluginService">
      <identity>
        <dns value="WCfServer" />
      </identity>
    </endpoint>

    <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"  />

    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://localhost:5812/Service/SimplePluginService.svc"/>
      </baseAddresses>
    </host>

  </service>
</services>


<behaviors>

  <serviceBehaviors>
    <behavior name="CommonBehavior">
      <serviceMetadata httpGetEnabled="True" policyVersion="Policy15" />
      <serviceDebug includeExceptionDetailInFaults="True"/>
        <serviceCredentials>

        <userNameAuthentication 
            userNamePasswordValidationMode="Custom"
            customUserNamePasswordValidatorType="Megatec.MasterTourService.CustomUserNameValidator, Megatec.MasterTourService"/>

        <serviceCertificate
            findValue="WCFServer"
            storeLocation="LocalMachine"
            storeName="My"
            x509FindType="FindBySubjectName"/>

        <clientCertificate>
          <authentication certificateValidationMode="PeerTrust" />
        </clientCertificate>

      </serviceCredentials>  
    </behavior>
  </serviceBehaviors>

</behaviors>

</system.serviceModel>

</configuration>
Run Code Online (Sandbox Code Playgroud)

我在本地 IIS 7.5 上调试它。站点和应用程序在活动协议列表中有“net.tcp”。

net.tcp 的 IIS 绑定是 5812:*

我有以下错误

没有为 URI 'net.tcp://myComputerName:5812/Service/SimplePluginService.svc/mex' 找到兼容的 TransportManager。这可能是因为您使用了指向虚拟应用程序外部的绝对地址,或者端点的绑定设置与其他服务或端点设置的不匹配。请注意,同一协议的所有绑定在同一应用程序中应具有相同的设置。

我已阅读以下问题 No compatible TransportManager error,但它对我不起作用。

更新。问题与 mex 端点有关。

我可以为服务创建不同的端点(具有不同的绑定和身份验证类型),但是 mex 端点使用 TransportManager 出错。

根据我的测试,它不取决于行为和安全模式(在绑定部分)。

那么,mex 端点有什么问题?

Eug*_*nov 5

在我的情况下,将 netTcpBinding 的 maxConnections 设置为 10 有帮助。

我不知道为什么......如果有人解释一下就好了。:)