我正在尝试为单个 WCF 服务执行多个端点,以便每个端点都有其单独的接口/方法。我正在使用 TCP
app.config
:
<configuration>
....
<system.serviceModel>
<services>
<service name="WCFLibrary.CalculatorService">
<host>
<baseAddresses>
<!--<add baseAddress="http://localhost:8788/CalculatorService/" />-->
<add baseAddress="net.tcp://localhost:8523/CalculatorService" />
</baseAddresses>
</host>
<endpoint name="ServiceTCPEndPoint"
address=""
binding="netTcpBinding"
contract="WCFLibrary.ICalculator">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint name="ServiceMexEndPoint" address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
</service>
<service name ="WCFLibrary.MyWorldService">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8524/MyWorldService"/>
</baseAddresses>
</host>
<endpoint name="HelloWorldTCPEndpoint"
address=""
binding="netTcpBinding"
contract="WCFLibrary.MyWorld">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint name="HelloWorldMexEndPoint"
address="mex"
binding="mexTcpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata/>
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
我的第一个端点正在工作,但我的第二个端点不起作用。这里可能有什么问题。其次,为什么我们不能像浏览 HTTP 一样浏览 tcp。我知道我们可以使用 svcutil 测试 tcp。反正有没有浏览TCP。
编辑:
周转基金:
Windows服务: