2011-01-31 91 views
0

好的,所以我有一個非常簡單的WCF服務,我想在IIS下託管。我已經啓用了「Windows Communication Foundation非Http激活」,所以這不是問題。我在安裝了.NET 4.0的Windows 7計算機上運行IIS 7,5。我的web.config看起來是這樣的:在IIS7中託管nettcp WCF服務失敗

<?xml version="1.0"?> 
<configuration> 
    <system.serviceModel> 
    <services> 
     <service name="FirstWcfService.Service" behaviorConfiguration="ServiceBehavior"> 
     <!-- Service Endpoints --> 
     <endpoint address="" binding="netTcpBinding" contract="NetTcpServiceTest.IMySuperService" 
      bindingConfiguration="tcpbinding"/> 
     <endpoint address="mextcp" binding="mexTcpBinding" contract="IMetadataExchange"/> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="ServiceBehavior"> 
      <!-- To avoid disclosing metadata information, set the value below to false 
       and remove the metadata endpoint above before deployment --> 
      <serviceMetadata httpGetEnabled="true"/> 
      <!-- To receive exception details in faults for debugging purposes, 
       set the value below to true. Set to false before deployment to avoid 
       disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="false"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <bindings> 
     <netTcpBinding> 
     <binding name="tcpbinding" portSharingEnabled="true"> 
      <!--<security mode="None"></security>--> 
      <security mode="Transport"> 
      <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign"/> 
      <message clientCredentialType="Windows"/> 
      </security> 
     </binding> 
     <binding name="mexTcpBinding" portSharingEnabled="true"> 
      <security mode="None" /> 
     </binding> 
     </netTcpBinding> 
    </bindings> 
    </system.serviceModel> 
</configuration> 

服務託管在IIS中的默認網站下稱「NetTcpServiceTest」的應用程序。當我嘗試添加引用的net.tcp:在Visual Studio中我得到以下錯誤//localhost/NetTcpServiceTest/MySuperService.svc/mextcp:

Metadata contains a reference that cannot be resolved: 'net.tcp://localhost/NetTcpServiceTest/MySuperService.svc/mextcp'. 
The message could not be dispatched because the service at the endpoint address 'net.tcp://localhost/NetTcpServiceTest/MySuperService.svc/mextcp' is unavailable for the protocol of the address. 
If the service is defined in the current solution, try building the solution and adding the service reference again. 

而且在事件日誌中的錯誤是:

An error occurred while trying to listen for the URL '/LM/W3SVC/1/ROOT/NetTcpServiceTest'. This worker process will be terminated. 
Sender Information: net.tcp 
Exception: System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler/65824025 
Process Name: System.ServiceModel.CommunicationException: The TransportManager failed to listen on the supplied URI using the NetTcpPortSharing service: . 

我也啓用了網站和應用程序的綁定。有誰知道如何解決這個問題?當我在互聯網上搜索它時,我發現的唯一答案是重新安裝IIS和.NET,但這聽起來不像是我真正的解決方案。

+0

您是否找到解決方案? – Martin 2011-07-08 15:37:02

回答

0

如果有機會在.NET之後安裝IIS,請嘗試aspnet_regiis.exe