Intermittent System.ServiceModel.Security.MessageSecurityException

时间:2015-05-29 18:23:37

标签: wcf azure-cloud-services

我在Azure中托管了一个Web服务,它会抛出间歇性的消息安全异常。我们确实有重试但是重试从未成功,即使代理在每次重试时都重新生成。有没有人知道关于如何获得真正异常的这个或任何指针?

例外: “exceptionMessage”:“从另一方收到了一个不安全或不正确安全的故障。请参阅内部FaultException以获取故障代码和详细信息。”, “exceptionType”:“System.ServiceModel.Security.MessageSecurityException”,  “innerExceptionTree”:“{\”InnerExceptions \“:[{\”InnerExceptions \“:null,\”Message \“:\”无法处理消息。这很可能是因为操作'http:\ / \ / schemas.xmlsoap.org \ / ws \ / 2005 \ / 02 \ / trust \ / RST \ / SCT \ / Cancel'不正确或因为邮件包含无效或过期的安全上下文令牌或因为绑定之间存在不匹配。如果服务因不活动而中止通道,则安全上下文令牌将无效。要防止服务中止空闲会话,请过早增加服务端点绑定的接收超时。\“,\”StackTrace \“:null,\”Type \“:\”System.ServiceModel.FaultException \“}],\”消息\“:\”从另一方收到了不安全或不正确安全的故障。请参阅内部FaultException以获取故障代码和详细信息。\“,\”StackTrace \“:\”\ u000d \ u000aServer堆栈跟踪:\ u000d \ u000a at System.ServiceModel.Security.SecuritySessionClientSettings“1.ClientSecuritySessionChannel.ProcessRequestContext(RequestContext requestContext System.ServiceModel.SecuritySessionClientSettings“1.ClientSecuritySessionChannel.ReceiveInternal(TimeSpan timeout,SecurityProtocolCorrelationState correlationState)\ u000d \ u000a at System.ServiceModel.Security.SecuritySessionClientSettings”1.SecurityRequestSessionChannel.CloseOutputSession,TimeSpan timeout,SecurityProtocolCorrelationState correlationState)\ u000d \ u000a (TimeSpan超时)\ u000d \ u000a在System.ServiceModel.Security.SecuritySessionClientSettings“1.ClientSecuritySessionChannel.CloseSession(TimeSpan timeout,Boolean& wasAborted)\ u000d \ u000a at System.ServiceModel.Security.SecuritySessionClientSettings”1.ClientSecuritySessionChannel.OnClose(TimeSpan)在System.Se上超时)\ u000d \ u000a System.ServiceModel.Channels.ServiceMhannel.OnClose(TimeSpan timeout)\ u000d \ u000a在System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)\ u000d \的rviceModel.Channels.CommunicationObject.Close(TimeSpan timeout)\ u000d \ u000a u000a \ u000d \ u000a在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke的System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)\ u000d \ u000a的[0]:\ u000d \ u000a处重新发生异常(MessageData&安培; msgData,Int32类型)\ u000d \ u000a at System.ServiceModel.ICommunicationObject.Close(TimeSpan timeout)\ u000d \ u000a at System.ServiceModel.ClientBase“1.System.ServiceModel.ICommunicationObject.Close(TimeSpan timeout)\ u000d \ u000a at at System.ServiceModel.ClientBase“1.Close()\ u000d \ u000a at System.ServiceModel.ClientBase”1.System.IDisposable.Dispose()\ u000d \ u000a

服务器的web.config:

&str[1]

客户端app.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.diagnostics>
    <trace>
      <listeners>
        <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
          <filter type="" />
        </add>
      </listeners>
    </trace>
  </system.diagnostics>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <authentication mode="Windows" />
  </system.web>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="binding" maxReceivedMessageSize="5000000" openTimeout="00:20:00" closeTimeout="00:20:00" sendTimeout="00:20:00" receiveTimeout="01:00:00">
          <readerQuotas maxStringContentLength="5000000" maxArrayLength="5000000" />
          <security mode="TransportWithMessageCredential">
            <message clientCredentialType="Certificate" negotiateServiceCredential="true"/>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="behavior" name="name">
        <endpoint address="" binding="wsHttpBinding" bindingConfiguration="binding"
          contract="contract" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="behavior">
          <serviceCredentials>
            <serviceCertificate findValue="15E957FE4732D15B8A88FE524B4CBF0B2F01B18E" storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint"/>
            <clientCertificate>
              <authentication certificateValidationMode="Custom" customCertificateValidatorType="customCertificateValidatorType, Eventing.Core"/>
            </clientCertificate>
          </serviceCredentials>
          <serviceMetadata httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceThrottling maxConcurrentCalls="500" maxConcurrentInstances ="500" maxConcurrentSessions ="500"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
    -->
    <directoryBrowse enabled="false" />
  </system.webServer>
</configuration>

我已经用Foo / Bar替换了一些机密信息。

0 个答案:

没有答案