我使用以下配置创建了服务
<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>
我在本地IIS 7.5上调试它。站点和应用程序在活动协议列表中有"net.tcp"。
net.tcp的IIS绑定为5812:*
我有以下错误
找不到URI"net"的兼容TransportManager。tcp://myComputerName:5812/Service/SimplePluginService.svc/mex"。这可能是因为您使用了指向虚拟应用程序外部的绝对地址,或者端点的绑定设置与其他服务或端点设置的绑定设置不匹配。请注意,同一协议的所有绑定在同一应用程序中都应该具有相同的设置。
我已经阅读了以下问题没有兼容的TransportManager错误,但它对我不起作用。
更新。问题与mex终结点有关。
我可以为服务创建不同的端点(使用不同的绑定和身份验证类型),但mex端点使用TransportManager犯了错误。
根据我的测试,这并不取决于行为和安全模式(在绑定部分)。
那么,mex端点的wroung是什么呢?
在我的情况下,将netTcpBinding的maxConnections设置为10会有所帮助。
我不知道为什么。。。如果有人解释一下就太好了
去掉endpoint
标记的address="UserName"
属性,因为它将在IIS控制台中配置。消息本身具有误导性,但不应与IIS一起定义地址。
我不知道为什么,但在绑定上设置maxConnections导致我们的服务无法激活,并出现与您相同的错误(在mex端点上)。
完全删除maxConnection属性为我们修复了它。