2011-06-27 78 views
0

我們在IIS 7中託管了RESTful WCF服務。我們希望服務可用於http和https。所以我們增加了2個綁定服務宿主
HTTP://service.abc.com
HTTPS://service.abc.comIIS 7上託管的WCF服務的ServiceActivationException

所有執行單項合同工作服務好,但是我們得到System.ServiceModel.ServiceActivationException對於實現多個合同的任何服務。

一切工作正常,只有一種類型的綁定或者httphttps

任何解決方案?

服務配置 -

<services> 
<service behaviorConfiguration="RESTServiceBehavior" name="App.Services.Service1"> 
    <endpoint address="" behaviorConfiguration="webBehavior" binding="webHttpBinding" contract="App.Contract.Services.IService1"       bindingConfiguration="RESTServiceBinding"></endpoint> 
</service> 
</services> 

<behaviors> 
<endpointBehaviors> 
    <behavior name="webBehavior"> 
     <webHttp/> 
     <restGlobalErrorHandler/> 
    </behavior> 
</endpointBehaviors> 

<serviceBehaviors> 
    <behavior name="RESTServiceBehavior"> 
     <serviceMetadata httpGetEnabled="true" /> 
     <serviceDebug includeExceptionDetailInFaults="false" /> 
     <serviceAuthorization serviceAuthorizationManagerType="App.Services.AuthorizationManager, App.Services" /> 
    </behavior> 
    <behavior name=""> 
     <serviceMetadata httpGetEnabled="true" /> 
     <serviceDebug includeExceptionDetailInFaults="false" /> 
    </behavior> 
</serviceBehaviors> 
</behaviors> 

<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true"/> 

<bindings> 
<webHttpBinding> 
    <binding name="RESTServiceBinding"> 
     <security mode="Transport"> 
     </security> 
    </binding> 
</webHttpBinding> 
</bindings> 
+1

我仍然不明白爲什麼人們會在沒有發佈錯誤消息的情況下詢問有關錯誤的問題。您還應提供有關如何配置服務的更多詳細信息。 –

回答

0

我是新來的WCF,但我讀它計算器,如果你的服務有幾個合同,那麼你必須爲每個合同的補充參考。如果有4個合同,則需要創建4個服務參考

+0

不可以。您還在添加單個引用,但您會得到4個代理。 –

0

您需要兩個端點用於您希望在服務上公開的每個合約。一個端點將用於HTTP,另一個端點用於HTTPS:

<service behaviorConfiguration="RESTServiceBehavior" name="App.Services.Service1"> 
    <endpoint address="" behaviorConfiguration="webBehavior" binding="webHttpBinding" 
       bindingConfiguration="RESTServiceBinding" contract="App.Contract.Services.IService1" /> 
    <endpoint address="" behaviorConfiguration="webBehavior" binding="webHttpBinding" 
       contract="App.Contract.Services.IService1" /> 
</service>