簡體   English   中英

在IIS7.5上托管的WCF netTcpBinding停止工作

[英]WCF netTcpBinding hosted on IIS7.5 Stops Working

我有一個簡單的.NET 4 WCF服務,我在IIS7.5上本地托管。 最初我使用httpBinding托管它工作正常。 然后我將其切換到netTcpBinding ,相應地更改web.config文件后也正常工作。 但是今天它決定停止工作。 我根本無法使用測試客戶端連接到服務,獲得:

URI: net.tcp://localhost/case/service.svc/mex Metadata contains a reference that cannot be resolved: 'net.tcp://localhost/case/service.svc/mex'. The message could not be dispatched because the service at the endpoint address 'net.tcp://localhost/case/service.svc/mex' is unavailable for the protocol of the address.

我已經檢查過(仍然)安裝了非http激活服務; net tcp listener服務正在運行; net.tcp位於站點的已啟用協議列表中; 我運行了servicemodelreg.exe -ia ; 我也重新運行aspnet_regiis.exe -i ; 最后我檢查了網站上的net.tcp綁定。

如果我運行netstat我可以看到正在偵聽端口的東西,但我無法連接到它。

這讓我瘋了,因為今天早上工作正常(就像上周一樣),現在卻沒有。

編輯:如果我在IE中訪問該服務,那么我可以看到它拋出以下異常:

Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http].

但是查看似乎不是這樣的web.config文件:

<services>
  <service behaviorConfiguration="ServiceBehavior" name="[REMOVED].[REMOVED]">
    <endpoint binding="netTcpBinding" bindingConfiguration="PortSharingBinding" contract="[REMOVED].[REMOVED]" />
    <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
  </service>
</services>

<bindings>
  <netTcpBinding>
    <binding name="PortSharingBinding" portSharingEnabled="true">
      <security mode="None"/>
    </binding>
    <binding name="mexTcpBinding" portSharingEnabled="true">
      <security mode="None" />
    </binding>
  </netTcpBinding>
</bindings>

好的,終於解決了。 我在站點級別啟用了net.tcp協議,但是在應用程序級別沒有啟用它。 我想它一定是以前的,我想我可能在更改項目名稱之前創建了一個新的應用程序,顯然忘了在應用程序上設置協議 - doh!

因此,在IIS上托管WCF net.tcp服務的最終清單是:

  1. 確保已安裝WCF非HTTP激活服務
  2. 確保Net.Tcp Listener服務和Net.Tcp Port Sharing服務都在運行
  3. 將net.tcp添加到站點和應用程序的已啟用協議中(要從IIS管理器訪問“高級設置”選項,您必須具有http綁定)
  4. 運行servicemodelreg.exe -ia以使用IIS注冊WCF元素
  5. 運行aspnet_regiis.exe -i以確保使用IIS正確設置.NET
  6. 將net.tcp綁定添加到站點

您是否檢查過端口共享已啟用?

請參閱http://msdn.microsoft.com/en-us/library/ms734772.aspx

編輯 - 對於WAS,還需要另一項服務:

除了NetTcpPortSharing之外,還需要服務NetTcpActivator ......

請參閱http://msdn.microsoft.com/en-us/magazine/cc163357.aspx

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM