Resolve a security context token that WCF callers are not authenticated by the server or that contain invalid or expired messages

Source: Internet
Author: User



Error Description:



1. WCF: Callers are not authenticated by the server



2. The message cannot be processed. This is most likely because the operation "Http://tempuri.org/ISCCLSvc/GetCarriersByWareHouse" is incorrect, or because the message contains an invalid or expired security context token, or because a mismatch occurs between bindings. If the service aborts the channel because it is not active, the security context token is not valid. To prevent the service from permanently aborting idle sessions, increase the receive timeout on the service endpoint bindings.



3. Or concurrent test, high concurrency problem 2, the actual case: the company Test Department results are concurrent to 50 will have a problem 2 error, and the average response time will be very slow






Resolved results:



Interface test Concurrency 100 no problem, and average response time reduced by 5 times times!






Workaround:



Major changes to the red text area






<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name= "Nonesecurity"
Maxbufferpoolsize= "12000000" maxreceivedmessagesize= "12000000" usedefaultwebproxy= "false" >
<readerquotas maxstringcontentlength= "12000000" maxarraylength= "12000000"/>
<security mode= "None"/>
</binding>
</wsHttpBinding>
</bindings>


<services>
<service name= "Wcfservice2.service1" behaviorconfiguration= "Wcfservice2.service1behavior" >
<!--Service Endpoints-
<endpoint address= "" binding= "Wshttpbinding"bindingconfiguration= "Nonesecurity"contract= "Wcfservice2.iservice1" >
<!--
When you deploy, you should remove or replace the following identity elements to reflect
The identity under which the deployment service runs. After deletion, WCF will
The corresponding identification is deduced automatically.
-
<identity>
<dns value= "localhost"/>
</identity>
</endpoint>
<endpoint address= "Mex" binding= "mexHttpBinding" contract= "IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name= "Wcfservice2.service1behavior" >
<!--to avoid leaking metadata information, set the following value to False before deployment and delete the above metadata endpoint--
<servicemetadata httpgetenabled= "true"/>
<!--to receive the fault exception details for debugging, set the following value to True. Set to false before deployment to avoid leaking exception information--
<servicedebug includeexceptiondetailinfaults= "false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>


The client changed the security configuration to <security mode= "None"/>









Detailed error message:


 
<p> </ p> <p> System.ServiceModel.Security.MessageSecurityException was unhandled
  Message = An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.
  Source = mscorlib
  StackTrace:
    Server stack trace:
       at System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.ProcessReply (Message reply, TimeSpan timeout, SecurityProtocolCorrelationState correlationState)
       at System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.Request (Message message, TimeSpan timeout)
       at System.ServiceModel.Dispatcher.RequestChannelBinder.Request (Message message, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannel.Call (String action, Boolean oneway, ProxyOperationRuntime operation, Object [] ins, Object [] outs, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService (IMethodCallMessage methodCall, ProxyOperationRuntime operation)
       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke (IMessage message)
    Exception rethrown at [0]:
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage (IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke (MessageData & msgData, Int32 type)
       at ApiStressTest.SCCL.ISCCLSvc.GetCarriersByWareHouse (TransModel tm)
       at ApiStressTest.SCCL.SCCLSvcClient.GetCarriersByWareHouse (TransModel tm) in D: \ SCCL \ ApiTest.new \ ApiStressTest \ Service References \ SCCL \ Reference.cs: line 198
       at ApiStressTest.ServiceWrapper.ServiceAPIWrapperMethod (Object stateInfo) in D: \ SCCL \ ApiTest.new \ ApiStressTest \ SCCLProgram.cs: line 416
       at System.Threading.ThreadHelper.ThreadStart_Context (Object state)
       at System.Threading.ExecutionContext.Run (ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run (ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart (Object obj)
  InnerException: System.ServiceModel.FaultException
       Message = Unable to process message. This is most likely because the operation "http://tempuri.org/ISCSvc/GetHouse" is incorrect, or because the message contains an invalid or expired security context token, or because of a mismatch between bindings. If the service aborts the channel because it is not active, the security context token is invalid. To prevent the service from permanently suspending idle sessions, increase the receive timeout on the service endpoint binding.
       InnerException:

</ p> <p>
</ p> 





Resolve a security context token that WCF callers are not authenticated by the server or that contain invalid or expired messages


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.