我在 IIS8 中有一个 WCF 服务主机,我想使用 net.tcp 绑定。
我有这个配置:
网页配置:
<service behaviorConfiguration="MyBehavior"
name="DecryptService.EmailCenterDecryptTCP">
<host>
<baseAddresses>
<add baseAddress="net.tcp://XX.XX.XX.XX:808/VirtualFolder/Service.svc" />
</baseAddresses>
</host>
<endpoint address=""
binding="netTcpBinding"
bindingConfiguration="portSharingBinding"
name="MyServiceEndpoint"
contract="ServiceNamespace.IService">
</endpoint>
<endpoint address="mextcp"
binding="mexHttpBinding"
bindingConfiguration=""
name="MyServiceMexTcpBidingEndpoint"
contract="IMetadataExchange" />
</service>
Run Code Online (Sandbox Code Playgroud)
当我尝试使用以下配置在与 IIS8 相同的机器上使用该服务时工作正常:
<client>
<endpoint address="net.tcp://YY.YY.YY.YY:808/VirtualFolder/Service.svc"
binding="netTcpBinding" bindingConfiguration="MyServiceEndpoint"
contract="ServiceReference1.IService" name="MyServiceEndpoint" />
</client>
Run Code Online (Sandbox Code Playgroud)
YY.YY.YY.YY 是机器的本地 IP,但是当我尝试在另一台机器上使用该服务时,将 YY.YY.YY.YY 更改为运行 IIS8 的机器的外部 IP (ZZ.ZZ.ZZ.ZZ)我收到以下错误:
There was no endpoint listening at net.tcp://ZZ.ZZ.ZZ.ZZ/VirtualFolder/Service.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, …Run Code Online (Sandbox Code Playgroud)