我在IIS 6中有一个WCF Web服务,并试图让它通过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 :(得分:3)
你有
<serviceMetadata httpGetEnabled="true" />
不应该是
<serviceMetadata httpsGetEnabled="true" />
注意httpsGetEnabled
...
如果你问我这个部分可以删除,因为它没有被端点使用......
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
如何将mex绑定更改为
binding="mexHttpsBinding"