我目前正在尝试使用本地托管的网站访问托管的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,但我仍然收到错误。
Web配置:
<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 Config Snippet:
<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>
答案 0 :(得分:0)
我也有同样的问题,一旦删除我的所有参考,然后我将再次创建。代码工作正常..试试你也...祝你好运......
谢谢,
Ramesh Periyasamy