2014-01-08 18 views
1

我使用的ASP.NET 3.5C#。我有一個web-application有一個WCF。我已經在服務器上部署了它,其中Bindings HTTPHTTPS。一切都很好。添加新的HTTP和HTTPS綁定後,WCF停止在IIS 7上工作

今天,我又在同一網站上添加了HTTPHTTPS的兩個以上綁定,但是在with different host names上添加了另外兩個綁定。 (我已經註冊了這個新域名,而且我已經用我的IP地址指出了這一點)。突然,該網站的WCF停止工作。

我爲IIS中的兩個網站做了這兩個網站,他們都在WCF呼叫返回異常,但login和所有其他網頁都正常工作。

web.config中的ServiceModel部分如下:

 <system.serviceModel> 
     <bindings> 
      <webHttpBinding> 
       <binding name="webBindingHTTP"> 
        <security mode="TransportCredentialOnly"> 
         <transport clientCredentialType="None" /> 
        </security> 
       </binding> 
       <binding name="webBindingHTTPS"> 
        <security mode="Transport"> 
         <transport clientCredentialType="None" /> 
        </security> 
       </binding> 
      </webHttpBinding> 
     </bindings> 
     <serviceHostingEnvironment aspNetCompatibilityEnabled="true"> 
     </serviceHostingEnvironment> 
     <behaviors> 
      <endpointBehaviors> 
       <behavior name="ihrole.service.remoteBehavior"> 
        <webHttp /> 
       </behavior> 
       <behavior name="webHttpEnabled"> 
        <webHttp/> 
       </behavior> 
      </endpointBehaviors> 
      <serviceBehaviors> 
       <behavior name="ihrole.service.remoteBehavior"> 
        <serviceMetadata httpGetEnabled="true" /> 
        <serviceDebug includeExceptionDetailInFaults="false" /> 
       </behavior> 
      </serviceBehaviors> 
     </behaviors> 
     <services> 
      <service behaviorConfiguration="ihrole.service.remoteBehavior" name="ihrole.service.remote"> 
       <endpoint address="" behaviorConfiguration="ihrole.service.remoteBehavior" bindingConfiguration="webBindingHTTP" binding="webHttpBinding" contract="ihrole.service.Iremote" /> 
       <endpoint address="" behaviorConfiguration="ihrole.service.remoteBehavior" bindingConfiguration="webBindingHTTPS" binding="webHttpBinding" contract="ihrole.service.Iremote" /> 
      </service> 
     </services> 
    </system.serviceModel> 

同樣,我有託管在同一IIS其他網站也有HTTPHTTPS綁定。但我沒有在這個網站上添加新的,並且WCF調用也正常工作。

任何猜測或解決方案? 在此先感謝..

+0

使用設置顯示您的Web.config –

+0

@FlopScientist我已使用servicemodel設置更新了該問題。 – Dev

+0

添加證書後發生完全相同的問題,事實證明Skype正在使用端口443,並且IIS無法啓動。只是想嘗試.. –

回答

1

這裏您需要指定您的WCF服務可以在單個網站的所有綁定上運行。

在Asp.Net 3.5中,當網站有多個綁定時,您應該使用<baseAddressPrefixFilters>元素指定通過過濾器(爲WCF服務添加基地址)。見下面的示例。 MSDN reference here.

<system.serviceModel> 
    <serviceHostingEnvironment> 
    ... 
     <baseAddressPrefixFilters> 
      <add prefix="http://Testsite2.com:3546"/> 
      <add prefix="http://testSite.com:3566"/> 
     </baseAddressPrefixFilters> 
    ... 
    </serviceHostingEnvironment> 
</system.serviceModel> 

所以,在這裏http://Testsite2.com:3546http://testSite.com:3566是唯一的基址,爲各自的計劃,這將允許經之地,這只是意味着WCF服務將針對這兩個地址工作。 baseAddressPrefixFilter不支持任何通配符。