Wcf 间歇性System.ServiceModel.Security.MessageSecurityException
我有一个托管在Azure中的Web服务,它会抛出间歇性的消息安全异常。我们确实有重试,但重试从未成功,即使每次重试时都会重新生成代理。有人知道这一点吗?有人知道如何找出真正的异常吗 例外情况: 例外消息:从另一方收到未安全或未正确安全的故障。有关故障代码和详细信息,请参见内部故障异常。, 异常类型:System.ServiceModel.Security.MessageSecurityException, innerExceptionTree:{\InnerExceptions\:[{\InnerExceptions\:null,\Message\:\无法处理消息。这很可能是因为操作“http:\/\/schemas.xmlsoap.org\/ws\/2005\/02\/trust\/RST\/SCT\/Cancel”不正确,或者是因为消息包含无效或过期的安全上下文令牌,或者是因为绑定之间不匹配。安全上下文令牌如果服务由于不活动而中止了通道,则ld无效。为了防止服务过早中止空闲会话,请增加服务端点绑定上的接收超时。\,\StackTrace\:null,\Type\:\System.ServiceModel.FaultException\}],\Message\:\从另一方接收到一个不安全或安全性不正确的故障。有关故障代码和详细信息,请参阅内部故障异常。\,\StackTrace\:\\u000d\u000a服务器堆栈跟踪:\u000d\u000a at System.ServiceModel.Security.SecuritySessionClient设置1.ClientSecuritySessionChannel.ProcessRequestContextRequestContext requestContext,TimeSpan timeout,SecurityProtocolCorrelationState correlationState\u000d\u000a位于System.ServiceModel.Security.SecuritySessionClientSettings1.ClientSecuritySessionChannel.ReceiveInternalTimeSpan timeout,SecurityProtocolCorrelationState correlationState\u000d\u000a位于System.ServiceModel.Security.SecuritySessionClientSettings1RequestSessionChannel.CloseOutputSessionTimeSpan超时\u000d\u000a在System.ServiceModel.Security.SecuritySessionClientSettings1.ClientSecuritySessionChannel.CloseSessionTimeSpan超时,布尔值&在System.ServiceModel.Security.SecuritySessionClientSettings1.ClientSecuritySessionChannel.OnCloseTimeSpan超时时中止\u000d\u000a在System.ServiceModel.Channels.CommunicationObject.CloseTimeSpan timeout\u000d\u000a在System.ServiceModel.Channels.ServiceChannel.OnCloseTimeSpan timeout\u000d\u000a在System.ServiceModel.Channels.CommunicationObject.CloseTimeSpan timeout\u000d\u000d\u000a在[0]处重试异常:\u000d\u000a at System.Runtime.Remoting.proxy.RealProxy.HandleReturnMessageIMessage reqMsg,IMessage retMsg\u000d\u000a at System.Runtime.Remoting.proxy.RealProxy.PrivateInvokeMessageData&msgData,Int32 type\u000d\u000a at System.ServiceModel.ICommunicationObject.CloseTimeSpan超时\u000d\u000a at System.ServiceModel.ClientBase1.SSystem.ServiceModel.ICommunicationObject.CloseTimeSpan超时\u000d\u000a在System.ServiceModel.ClientBase1.Close\u000d\u000a在System.ServiceModel.ClientBase1.System.IDisposable.Dispose\u000d\u000a 服务器的web.config:Wcf 间歇性System.ServiceModel.Security.MessageSecurityException,wcf,azure-cloud-services,Wcf,Azure Cloud Services,我有一个托管在Azure中的Web服务,它会抛出间歇性的消息安全异常。我们确实有重试,但重试从未成功,即使每次重试时都会重新生成代理。有人知道这一点吗?有人知道如何找出真正的异常吗 例外情况: 例外消息:从另一方收到未安全或未正确安全的故障。有关故障代码和详细信息,请参见内部故障异常。, 异常类型:System.ServiceModel.Security.MessageSecurityException, innerExceptionTree:{\InnerExceptions\:[{\Inne
<?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>
客户端app.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.net>
<connectionManagement>
<add maxconnection = "500" address ="*" />
</connectionManagement>
</system.net>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IFoo"
closeTimeout="00:20:00"
openTimeout="00:20:00"
receiveTimeout="00:20:00"
sendTimeout="00:20:00"
maxBufferPoolSize="5000000"
maxReceivedMessageSize="5000000">
<readerQuotas maxDepth="32"
maxStringContentLength="5000000"
maxArrayLength="5000000"
maxBytesPerRead="5000000"
maxNameTableCharCount="5000000" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" />
<message clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://foo.cloudapp.net/bar.svc"
behaviorConfiguration="serviceBehavior" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_Foo"
contract="XYZ.IAbc" name="WSHttpBinding_IFoo" />
</client>
<behaviors>
<endpointBehaviors>
<behavior name="serviceBehavior">
<clientCredentials>
<clientCertificate storeName="My" storeLocation="LocalMachine" x509FindType="FindByThumbprint" findValue="e1aa390214b6c7c0ec2b71624cafb0b5ffdccefd" />
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
我已经用Foo/Bar替换了一些机密信息。您曾经解决过这个问题吗?