Wcf – error :Security processor was unable to find a security header in the message

wcf

I've a Windows based application using a WCF service hosted in IIS of development server. I'm calling a method defined in the service to run an SSIS package at the SQL database. The method returns success or failure to the client based on whether the package is executed successfully or not.

The package gets executed at the database successfully at all times but the service throws this error ONLY when the package takes longer than roughly 10 mins to execute. Otherwise I do not get this error.

I've already tried the following with no success:-

  1. Increase the client timeouts in the app.config to higher value like 20 mins.
  2. Increase the httpRuntime executionTimeout value in the web.config to a high value like 7200 secs.

The tracelog contains the following error:-

Security processor was unable to find a security header in the message. This might be because the message is an unsecured fault or because there is a binding mismatch between the communicating parties. This can occur if the service is configured for security and the client is not using security.

stack trace:

System.ServiceModel.Security.SecurityStandardsManager.CreateReceiveSecurityHeader(Message message, String actor, SecurityAlgorithmSuite algorithmSuite, MessageDirection direction)
System.ServiceModel.Security.MessageSecurityProtocol.CreateSecurityHeader(Message message, String actor, MessageDirection transferDirection, SecurityStandardsManager standardsManager)
System.ServiceModel.Security.MessageSecurityProtocol.ConfigureReceiveSecurityHeader(Message message, String actor, SecurityProtocolCorrelationState[] correlationStates, SecurityStandardsManager standardsManager, IList1& supportingAuthenticators)
System.ServiceModel.Security.InitiatorSessionSymmetricMessageSecurityProtocol.VerifyIncomingMessageCore(Message& message, String actor, TimeSpan timeout, SecurityProtocolCorrelationState[] correlationStates)
System.ServiceModel.Security.MessageSecurityProtocol.VerifyIncomingMessage(Message& message, TimeSpan timeout, SecurityProtocolCorrelationState[] correlationStates)
System.ServiceModel.Security.SecuritySessionClientSettings
1.ClientSecuritySessionChannel.VerifyIncomingMessage(Message& message, TimeSpan timeout, SecurityProtocolCorrelationState correlationState)
System.ServiceModel.Security.SecuritySessionClientSettings1.ClientSecuritySessionChannel.ProcessIncomingMessage(Message message, TimeSpan timeout, SecurityProtocolCorrelationState correlationState, MessageFault& protocolFault)
System.ServiceModel.Security.SecuritySessionClientSettings
1.ClientSecuritySessionChannel.ProcessRequestContext(RequestContext requestContext, TimeSpan timeout, SecurityProtocolCorrelationState correlationState)
System.ServiceModel.Security.SecuritySessionClientSettings1.ClientSecuritySessionChannel.ReceiveInternal(TimeSpan timeout, SecurityProtocolCorrelationState correlationState)
System.ServiceModel.Security.SecuritySessionClientSettings
1.SecurityRequestSessionChannel.CloseOutputSession(TimeSpan timeout)
System.ServiceModel.Security.SecuritySessionClientSettings1.ClientSecuritySessionChannel.CloseSession(TimeSpan timeout, Boolean& wasAborted)
System.ServiceModel.Security.SecuritySessionClientSettings
1.ClientSecuritySessionChannel.OnClose(TimeSpan timeout)
System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
System.ServiceModel.Channels.ServiceChannel.OnClose(TimeSpan timeout)
System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
System.ServiceModel.Channels.ServiceChannelProxy.ExecuteMessage(Object target, IMethodCallMessage methodCall)
System.ServiceModel.Channels.ServiceChannelProxy.InvokeChannel(IMethodCallMessage methodCall)
System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
System.ServiceModel.ICommunicationObject.Close(TimeSpan timeout)
System.ServiceModel.ClientBase1.System.ServiceModel.ICommunicationObject.Close(TimeSpan timeout)
System.ServiceModel.ClientBase
1.Close()
MemberPlus.MemberPlusShared.ServiceProxy`1.Dispose()
MemberPlusDataLoads.DataLoads.ProcessData()
MemberPlusDataLoads.DataLoads.DoProcessData()
System.Threading.ThreadHelper.ThreadStart_Context(Object state)
System.Threading.ExecutionContext.runTryCode(Object userData)
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
System.Threading.ThreadHelper.ThreadStart()

I also get the following error:

The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.

stack trace :

System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
System.ServiceModel.Channels.ClientReliableChannelBinder1.RequestClientReliableChannelBinder1.OnRequest(TRequestChannel channel, Message message, TimeSpan timeout, MaskingMode maskingMode)
System.ServiceModel.Channels.ClientReliableChannelBinder1.Request(Message message, TimeSpan timeout, MaskingMode maskingMode)
System.ServiceModel.Channels.ClientReliableChannelBinder
1.Request(Message message, TimeSpan timeout)
System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.Request(Message message, TimeSpan timeout)
System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
IDataLoadService.LaunchPackage(String sourceType, String packageName, Int32 fileId, Int32 ign)
DataLoadServiceClient.LaunchPackage(String sourceType, String packageName, Int32 fileId, Int32 ign)
MemberPlusDataLoads.DataLoads.ProcessData()
MemberPlusDataLoads.DataLoads.DoProcessData()
System.Threading.ThreadHelper.ThreadStart_Context(Object state)
System.Threading.ExecutionContext.runTryCode(Object userData)
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
System.Threading.ThreadHelper.ThreadStart()

My app.config :-

<
binding name="WSHttpBinding_IDataLoadService" closeTimeout="00:12:00"
openTimeout="00:12:00" receiveTimeout="00:12:00" sendTimeout="00:12:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<
readerQuotas maxDepth="32" maxStringContentLength="2147483647"

maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<
reliableSession ordered="true" inactivityTimeout="00:20:00"
enabled="false" />
<
security mode="Message">
<
transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<
message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />

<
endpoint address="http://testappdbd/MemberPlusService/DataLoadService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IDataLoadService"
contract="IDataLoadService" name="WSHttpBinding_IDataLoadService">
<
identity>
<
userPrincipalName value="testappdbd\ASPNET" />

The web.config:

<
system.web> <
httpRuntime maxRequestLength="2097151"
executionTimeout="7200"
useFullyQualifiedRedirectUrl="false"
minFreeThreads="8"
minLocalRequestFreeThreads="4"
appRequestQueueLimit="100" />
<
compilation debug="false" />

<
wsHttpBinding>
<
binding name="DLBinding"
maxReceivedMessageSize="2147483647" >

<
behavior name="DLServiceBehavior">
<
serviceMetadata httpGetEnabled="true" />
<
serviceDebug includeExceptionDetailInFaults="true" />
<
dataContractSerializer maxItemsInObjectGraph="2147483647" />

<
service name="DataLoadsService.ServiceImplementation.DataLoadsService" behaviorConfiguration ="DLServiceBehavior"> <
endpoint address="" binding="wsHttpBinding" bindingConfiguration="DLBinding"
contract="DataLoadsService.ServiceContract.IDataLoadService" />
<
endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />

I used breakpoints at client side method which calls the service to see what's happening and i find that the client side connection remains open for entire length of time set under timeouts (12 mins) but the server side does not return the message.

Any thoughts on where the problems might be and the solution?

Best Answer

It may be a mismatch between the configuration on the client and the server.

Try putting all your configuration in a binding configuration and then use the same binding configuration on the server and client.

Related Topic