2017-05-30 4 views
0

別のWebサービスを呼び出すWebサービスを使用しています。私のアプリケーションは、短時間で大量の電話をかけたときにシナリオを実行できます。ある時点で、Webサービスはエラー401 Unauthorizedを返すようになります。ここに詳細なエラーがあります:多くのWebサービスコールでランダムに401の無許可応答が発生しました

<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&amp; 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> 

これはいくつかのエラーをスローしてから、うまく動作します。これらの呼び出しには全く違いがないので、なぜそれらの一部がうまく動作するのか理解できません。ここで

は私の設定です:

<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> 

どれ提案してください?

答えて

0

このような状況では、レスポンスコードが間違っていますが、スロットルが減っている可能性があります。しかし、これは分散サービスの性質です。問題を軽減するために何らかのリトライポリシーを採用することをお勧めします。それはあなたの要求の頻度を減らすためにあなた自身のレート制限を導入するか導入します。または、リクエストをバッチ処理して、1000の代わりに1つだけ送信すれば、おそらく最適な解決策になります。

関連する問題