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