2012-01-11 37 views
0

这是iam获取的错误:WCF安全执行错误

无法处理消息。这很可能是因为动作'http://tempuri.org/xxxxxx'不正确,或者因为消息包含无效或过期的安全上下文令牌或者因为绑定之间存在不匹配。如果服务由于不活动而中止通道,则安全上下文令牌将无效。为了防止服务中止空闲会话过早加大对服务端点的绑定

这里是我的web.config副本接收超时:

<?xml version="1.0"?> 
<configuration> 
    <system.web> 
    <compilation debug="true" targetFramework="4.0"> 
     <assemblies> 
     <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> 
     </assemblies> 
    </compilation> 
    </system.web> 
    <system.serviceModel> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="wsUserNameToken"> 
      <security mode="TransportWithMessageCredential"> 
      <transport clientCredentialType="None"/> 
      <message clientCredentialType="UserName"/> 
      </security> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 
    <services> 
     <service name="ServiceName" behaviorConfiguration="userNameTokenBehavior"> 
     <endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsUserNameToken" name="userNameTokenService" contract="ContractName"/> 
     <endpoint address="mex" binding="wsHttpBinding" bindingConfiguration="wsUserNameToken" name="MexHttpsBindingEndpoint" contract="IMetadataExchange" /> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="userNameTokenBehavior"> 
      <serviceMetadata httpsGetEnabled="true"/> 
      <serviceDebug includeExceptionDetailInFaults="false"/> 
      <serviceCredentials> 
      <serviceCertificate findValue="xxxxxxxxxxxxx" x509FindType="FindByThumbprint" storeLocation="LocalMachine" storeName="My" /> 
      <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="xxxxx.xxxxx.UsernameValidator, App_Code"/> 
      </serviceCredentials> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 
    <system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 
</configuration> 

谁能请弄清楚什么是错我的配置文件?

+1

WCF是客户端和服务器之间的舞蹈。你是否也可以包含你的客户端配置。 – 2012-01-11 15:54:21

+0

您的服务名称属性和端点合同属性应该是完全限定名称。同时启用跟踪您的服务,以了解为什么事情失败的原因 – Rajesh 2012-07-30 15:40:59

回答

0

在您的wsHttpBinding元素中,您可以添加属性recieveTimeout并将其值设置为较大值并进行检查。下面是一个示例:

<binding name="wsUserNameToken" closeTimeout="00:01:00" openTimeout="00:01:00" 
      receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" 
      transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
      maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" 
      useDefaultWebProxy="true" allowCookies="false"> 

也可以尝试让你的服务Tracing和检查日志,以确定为何请求失败的原因。

希望有所帮助。

+1

这显然不是他的问题的解决方案。 WCF绑定问题几乎总是不是由超时问题引起的。 – user989056 2012-07-30 15:33:06

0

检查您的元数据绑定。绑定应该是mexHttpsBinding而不是wsHttpBinding