gpt4 book ai didi

WCF over SSL 问题

转载 作者:太空宇宙 更新时间:2023-11-03 12:52:55 24 4
gpt4 key购买 nike

我在 IIS 6 中有一个 WCF Web 服务,并试图让它通过 SSL 工作。当我调用该服务时,出现以下错误:

无法处理消息。这很可能是因为操作“http://tempuri.org/IARPolicyComposer/GetTemplatesList”不正确,或者因为消息包含无效或过期的安全上下文 token ,或者因为绑定(bind)之间存在不匹配。如果服务由于不活动而中止 channel ,则安全上下文 token 将无效。为防止服务过早中止空闲 session ,增加服务端点绑定(bind)的接收超时。

这是服务配置:

<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>

服务和客户端都在同一个域中。

最佳答案

你有

<serviceMetadata httpGetEnabled="true" /> 

不应该吗

<serviceMetadata httpsGetEnabled="true" />

注意 httpsGetEnabled 中的 s...

如果你问我这部分可以删除,因为它没有被端点使用......

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

如何将 mex 绑定(bind)更改为

binding="mexHttpsBinding"

关于WCF over SSL 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7649467/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com