I have consuming Web Service that's calling another web service. My Application can run a scenario when it makes a lot of calls in short period of time. At some point of time Web Service starts throwing back error 401 Unauthorized. Here's detailed error:
<Exception>
<Source>mscorlib</Source>
<Message>The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate,NTLM'.</Message>
<Stack>
Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ValidateAuthentication(HttpWebRequest request, HttpWebResponse response, WebException responseException, HttpChannelFactory`1 factory)
at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory`1 factory, WebException responseException, ChannelBinding channelBinding)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.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 KwikTagWebInterface.DMSWebSrv.IWOVServicesSoap.CreateDocuments(CreateDocumentsRequest request)
at KwikTagWebInterface.DMSWebSrv.WOVServicesSoapClient.CreateDocuments(CreateDocumentsInput CreateDocuments1)
at KwikTagWebInterface.Controllers.DMSConnector.CreateDocumentProforma(String profIndex, String matter, String userName)
at KwikTagWebInterface.KTWebServices.TagProformaECover(String profIndex, String matter, String userName, String userDomain)</Stack>
<InnerException>
<Source>System</Source>
<Message>The remote server returned an error: (401) Unauthorized.</Message>
<Stack> at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)</Stack>
</InnerException>
</Exception>
It throws several errors like this and then continue working just fine. There is absolutely no difference between those calls, so I don't understand why some of them works fine and some of them don't.
Here's my configuration:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="IWOVServicesSoap" maxReceivedMessageSize="2097152" maxBufferSize="2097152" maxBufferPoolSize="2097152">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://Server/Application/Services/IWOVServices.asmx"
binding="basicHttpBinding" bindingConfiguration="IWOVServicesSoap"
contract="WebSrv.IWOVServicesSoap" name="IWOVServicesSoap" />
</client>
</system.serviceModel>
Any suggestion please?