2012-05-24 60 views
1

我想讓我的WCF服務與netTcpBinding一起工作,而不是wsHttpBinding,但我似乎無法讓它工作。IIS 7.5/WCF - net.tcp狀態不明

我添加了net.tcp綁定到IIS7.5,但狀態爲未知(,當我也刪除http綁定它通過該網站放大紅色X,我必須添加一個新的http綁定,纔可以訪問任何設置再次)。我已經看過這裏和谷歌,但我只能找到兩三個關於這個問題的帖子,沒有任何真正的解決方案。

我有什麼:

  • WAS服務運行,而且淨*服務。
  • 在IIS的高級設置中添加了net.tcp。
  • 已安裝WCF非http。

似乎是運行TCP監聽器,因爲它顯示了在netstat的,它是我指定的端口上監聽:809),我也得到了防火牆消息(也嘗試禁用防火牆/殺毒軟件,但它沒沒有幫助)。

WCF測試客戶端導致此錯誤:

Error: Cannot obtain Metadata from net.tcp://localhost:809/MyService.svc

我的web.config(從MSDN複製居多,適當佈局看這裏http://pastebin.com/Ru8p0T9N):

<services> 
    <service behaviorConfiguration="MyBehavior" name="WCFService.MyService"> 
    <endpoint address="" binding="netTcpBinding" bindingConfiguration="Binding1" name="MyServiceEndpoint" contract="WCFService.MyService"> 
     <identity> 
     <dns value="localhost" /> 
     </identity> 
    </endpoint> 
    <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" name="MyServiceMexTcpBidingEndpoint" contract="IMetadataExchange" /> 
    <host> 
     <baseAddresses> 
     <add baseAddress="net.tcp://localhost:809/MyService.svc" /> 
     </baseAddresses> 
    </host> 
    </service> 
</services> 
<behavior name="MyBehavior"> 
    <serviceMetadata httpGetEnabled="false" /> 
    <serviceDebug includeExceptionDetailInFaults="true" /> 
</behavior> 
<netTcpBinding> 
    <binding name="Binding1"hostNameComparisonMode="StrongWildcard"sendTimeout="00:10:00"maxReceivedMessageSize="65536"transferMode="Buffered"portSharingEnabled="true"> 
    <security mode="Message"> 
     <transport clientCredentialType="None" /> 
     <message clientCredentialType="None" /> 
    </security> 
    </binding> 
</netTcpBinding> 

一切工作正常wsHttpBinding但不是net.tcp。我在多個來源的Web.config中嘗試了幾個不同的設置,但是我一直都遇到同樣的問題。

+0

您是否驗證了以下文章中的所有扭結:http://www.codegain.com/articles/wcf/howto/hosting-wcf-service-with-nettcpbinding-on-iis7.aspx – AvkashChauhan

+0

感謝您的鏈接,我把應用程序池放在經典模式(以前​​沒有),但仍然是相同的錯誤。 –

回答

0

對於有同樣問題的人:正如我之前所說,我將應用程序池更改爲經典,並且它沒有工作(http也沒有工作不過),但是當我將它更改回來並回收應用程序池時,它突然生效。

1

您是否將net.tcp添加爲IIS中的已啓用協議?管理網站=>高級設置=>啓用的協議(逗號分隔)

+0

是的,我做了(另見第一篇文章);)我將它作爲MSDN上描述的http,net.tcp。 –