我目前正在尝试使用本地托管的网站访问托管的 WCF 服务,该网站在服务器上成功运行(我能够访问 wsdl 等)。
我收到错误消息:
The message could not be processed. This is most likely because the action 'http://tempuri.org/IBetFriendService/SelectCustomerUsernamePasswordLogin' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding.
我已将 receiveTimeout 和 inactivityTimeout 都增加到 12:00:00,但我仍然收到错误消息。
网络配置:
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IBetFriendService1" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="12:00:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="6553600" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="12:30:00"
enabled="false" />
<security mode="None">
<transport clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://bet-friend.org.uk/BetFriendLibrary.BetFriendService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IBetFriendService1"
contract="BetFriendServiceReference2.IBetFriendService" name="WSHttpBinding_IBetFriendService1">
<identity>
<dns />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
WCF 配置片段:
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<services>
<service name="BetFriendLibrary.BetFriendService">
<endpoint address="" binding="wsHttpBinding" contract="BetFriendLibrary.IBetFriendService">
<identity>
<dns />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://bet-friend.org.uk/BetFriendLibrary.BetFriendService.svc" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>