1
我需要在WAS中托管WCF服务的一些帮助。 我在IIS中托管了服务,并通过basicHttp和wsHttp绑定进行访问。 但是,当我尝试在WAS中托管它并通过tcp/ip进行访问时,似乎错过了一些东西。WAS中的主机WCF服务
我需要配置它的端口访问通过TCP 10000
我启用WCF激活了非HTTP的Windows功能
该服务在默认Web站点,应用程序mywcfapp
公布我创建了一个BAT文件,以使上的net.tcp默认的Web站点和下面mywcfapp端口10000绑定:
%windir%\system32\inetsrv\appcmd.exe set site "Default Web Site" -+bindings.[protocol='net.tcp',bindingInformation='10000:*']
%windir%\system32\inetsrv\appcmd.exe set app "Default Web Site/mywcfapp" /enabledProtocols:http,net.tcp
的我们b.config是
<services>
<service name="MyWcfService">
<clear />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"
listenUriMode="Explicit" />
<endpoint address="net.tcp://localhost:10000/mywcfapp/mywcfapp.svc"
binding="netTcpBinding" bindingConfiguration="PortSharingBinding" contract="MyApp.IService" />
<endpoint address="net.tcp://localhost:10000/mywcfapp/mywcfapp.svc"
binding="netTcpBinding" bindingConfiguration="PortSharingBinding" contract="MyApp.IService" />
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="PortSharingBinding" portSharingEnabled="true">
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
但是,似乎我无法访问该服务。
当我尝试使用URI
net.tcp://localhost:10000/mywcfapp/mywcfapp.svc/mex
我碰到下面的错误与WcfTestClient访问服务
<Fault xmlns="http://www.w3.org/2003/05/soap-envelope">
<Code>
<Value>Sender</Value>
<Subcode><Value xmlns:a="http://www.w3.org/2005/08/addressing">a:DestinationUnreachable</Value>
</Subcode>
</Code>
<Reason><Text xml:lang="ro-RO">
The message with To 'net.tcp://localhost:10000/mywcfapp/mywcfapp.svc/mex'
cannot be processed at the receiver, due to an AddressFilter mismatch
at the EndpointDispatcher.
Check that the sender and receiver's EndpointAddresses agree.
</Text></Reason>
</Fault>
如果我尝试使用URL连接(W/O指定端口)
net.tcp://localhost/OneTest.Service/OneTest.Service.svc/mex
我得到的错误(只保留有效部分)
Could not connect to net.tcp://localhost/mywcfapp/mywcfapp.svc/mex.
The connection attempt lasted for a time span of 00:00:02.0041146.
TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:808.
No connection could be made because the target machine actively refused it 127.0.0.1:808
谢谢,我检查,这是已启用(我猜我启用了它,当我运行BAT)。但是,我怀疑这个问题与港口有关。奇怪的是,如果我在WCF测试客户端的URI中包含端口(10000),则EndpointDispatcher中的错误是AddressFilter不匹配。如果我不包含URI中的端口,看起来客户端正尝试连接到端口808上的服务器,但为什么? – bzamfir
确保http和net.tcp之间没有空格,只是逗号。 – Tim