我想使用 netTcpBinding 和 basicHttpBinding 提供相同的接口。我还想为两个端点提供 wsdl。当我访问时http://localhost:9876/TestService/
,我得到了包含 Tcp 端点信息的 mex 端点http://localhost:9876/TestService/?wsdl
,但地址http://localhost:9876/TestService/ws
没有响应,我不明白为什么。我有基地址和相对地址。有人可以帮我指出缺少的东西吗?现在,我只是在尝试使用 TestImplementation 服务,而我还没有搞乱 MessaginImplementation 服务。
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="SimpleBinding" />
</basicHttpBinding>
<netTcpBinding>
<binding name="DefaultTCPBinding" transactionFlow="true" />
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="MetadataBehavior">
<serviceMetadata httpGetEnabled="true" httpGetBinding="webHttpBinding"
httpGetBindingConfiguration="" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MetadataBehavior" name="CompanyX.AppServer.Implementation.TestImplementation">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="DefaultTCPBinding"
name="TestTCPEndpoint" contract="CompanyX.AppServer.Interfaces.ITest" />
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
name="TestMex" contract="IMetadataExchange" />
<endpoint address="/ws" binding="basicHttpBinding" bindingConfiguration="SimpleBinding"
name="Test" contract="CompanyX.AppServer.Interfaces.ITest" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9878/TestService" />
<add baseAddress="http://localhost:9876/TestService/" />
</baseAddresses>
</host>
</service>
<service behaviorConfiguration="MetadataBehavior" name="CompanyX.AppServer.Implementation.MessaginImplementation">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="DefaultTCPBinding"
name="MessagingTCPEndpoint" contract="CompanyX.AppServer.Interfaces.IMessaging" />
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
name="MessagingMex" contract="CompanyX.AppServer.Interfaces.IMessaging" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9878/MessagingService" />
<add baseAddress="http://localhost:9876/MessagingService" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>