2011-10-04 82 views
3

我在IIS 6中有一個WCF Web服務,並試圖讓它通過SSL工作。當我致電該服務時,出現以下錯誤:WCF over SSL問題

該消息無法處理。這很可能是因爲動作'http://tempuri.org/IARPolicyComposer/GetTemplatesList'不正確或者因爲消息包含無效或過期的安全上下文令牌或者因爲綁定之間存在不匹配。如果服務由於不活動而中止通道,則安全上下文令牌將無效。爲防止服務過早地中止空閒會話,會增加服務端點綁定的接收超時。

這裏的服務配置:

<system.serviceModel> 
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
<bindings> 
    <wsHttpBinding> 
    <binding name="WSHttpBinding_IARPolicyComposer"> 
     <security mode="Transport"> 
     </security> 
    </binding> 
    </wsHttpBinding> 
</bindings> 
<services> 
<service behaviorConfiguration="PolicyComposer.ARPolicyComposerBehavior" name="PolicyComposer.ARPolicyComposer"> 
      <endpoint address="" binding="wsHttpBinding" contract="PolicyComposer.IARPolicyComposer"> 
      </endpoint> 
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
</service> 
</services> 
<behaviors> 
<serviceBehaviors> 
<behavior name="PolicyComposer.ARPolicyComposerBehavior"> 
    <serviceMetadata httpGetEnabled="true" /> 
<serviceDebug includeExceptionDetailInFaults="true" /> 
</behavior> 
<behavior name=""> 
<serviceMetadata httpGetEnabled="true" /> 
<serviceDebug includeExceptionDetailInFaults="false" /> 
</behavior> 
</serviceBehaviors> 

客戶端的配置:

<wsHttpBinding> 
    <binding name="WSHttpBinding_IARPolicyComposer" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> 
     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
     <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> 
     <security mode="Transport"> 
     </security> 
    </binding> 
    </wsHttpBinding> 

兩個服務端和客戶端都在同一個域。

+0

起初我會忽略有關的意見*接收超時*,其更可能有安全設置做。 –

+0

沒有ssl它工作?如果從未嘗試使其無需ssl第一個工作... –

+0

在日誌文件中記錄以下錯誤,我看到我的網站沒有證書,'Requires SSL'也沒有選中:**找不到基地址與綁定WSHttpBinding的端點匹配scheme https。註冊的基地址方案是[http] .. ** – Evan

回答

3

你有

<serviceMetadata httpGetEnabled="true" /> 

它不應該是

<serviceMetadata httpsGetEnabled="true" /> 

心靈的小號httpsGetEnabled ......

如果你問我可以,因爲除去這部分它不被端點使用...

<behavior name=""> 
    <serviceMetadata httpGetEnabled="true" /> 
    <serviceDebug includeExceptionDetailInFaults="false" /> 
</behavior> 

如何改變MEX結合

binding="mexHttpsBinding" 
+0

+1的地方工作。注意,您可以在配置中同時使用http和https,但對於SSL來說,https是必不可少的。 –

+0

我將httpGetEnabled更改爲httpsGetEnabled,但仍然出現相同的錯誤 – Evan