2009-10-22 21 views
12

残念ながら、これは少し長いですが、私はより少ないよりも投稿する方が良いと思いました。確立された接続は、ホストマシンのソフトウェアによって中止されました

これも私の最初の投稿ですので、許してください。

私はこのことをしばらく考えようとしています。これまでに遭遇した天才がいることを願って、無駄にしています。

これは断続的な問題であり、再現が困難です。 私が実行しているコードは単純にWebサービスを呼び出します Webサービスの呼び出しはループしています(1500回以上実行している可能性があります)

エラーを引き起こすコードは次のとおりです。ここで

HttpWebRequest groupRequest = null; 
WebResponse groupResponse = null;    
try 
{  
    XmlDocument doc = new XmlDocument(); 
    groupRequest = (HttpWebRequest)HttpWebRequest.Create(String.Format(Server.HtmlDecode(Util.GetConfigValue("ImpersonatedSearch.GroupLookupUrl")),userIntranetID)); 
    groupRequest.Proxy = null; 
    groupRequest.KeepAlive = false; 
    groupResponse = groupRequest.GetResponse(); 
    doc.Load(groupResponse.GetResponseStream()); 
    foreach (XmlElement nameElement in doc.GetElementsByTagName(XML_GROUP_NAME)) 
    { 
     foreach (string domain in _groupDomains) 
     { 
      try 
      { 
       string group = new System.Security.Principal.NTAccount(domain, nameElement.InnerText).Translate(typeof(System.Security.Principal.SecurityIdentifier)).Value; 
       impersonationChain.Append(";").Append(group);        
       break; 
      } 
      catch{}       
     } // loop through    
    } 
} 
catch (Exception groupLookupException) 
{ 
    throw new ApplicationException(String.Format(@"Impersonated Search ERROR: Could not find groups for user<{0}\{1}>", userNTDomain, userIntranetID), groupLookupException); 
} 
finally 
{ 
    if (groupResponse != null) 
    { 
     groupResponse.Close(); 
    } 
} 

時々起こるエラーです:それは通読するコードの多くだった

Could not find groups for user<DOMAIN\auser> ---> System.IO.IOException: Unable to read 
data from the transport connection: An established connection was aborted by the 
software in your host machine. ---> System.Net.Sockets.SocketException: An established 
connection was aborted by the software in your host machine at 
System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags 
socketFlags) at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 
size) --- End of inner exception stack trace --- at System.Net.ConnectStream.Read(Byte[] 
buffer, Int32 offset, Int32 size) at System.Xml.XmlTextReaderImpl.ReadData() at 
System.Xml.XmlTextReaderImpl.ParseDocumentContent() at 
System.Xml.XmlLoader.LoadDocSequence 
(XmlDocument parentDoc) at System.Xml.XmlDocument.Load(XmlReader reader) at 
System.Xml.XmlDocument.Load(Stream inStream) at 
MyWebServices.ImpersonatedSearch.PerformQuery(QueryParameters parameters, 
String userIntranetID, String userNTDomain)--- End of inner exception stack trace 
---at MyWebServices.ImpersonatedSearch.PerformQuery(QueryParameters parameters, String userIntranetID, String userNTDomain) 
--- End of inner exception stack trace --- 
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, 
WebResponse response, Stream responseStream, Boolean asyncCall) 
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, 
Object[] parameters) at MyProgram. MyWebServices.ImpersonatedSearch.PerformQuery 
(QueryParameters parameters, String userIntranetID, String userNTDomain) 
at MyProgram.MyMethod() 

は申し訳ありません。
これは約1700回のうち約30回発生します。

+0

このエラーはクライアント側かサーバー側ですか? – Zote

+0

クライアントサイドですが、これはWebサービスからスローされました – TheCodeFool

答えて

8

おそらくタイムアウトが発生しています。まず、キープアライブを再びオンにします。次に、リクエストのタイムスタンプを確認して返信します。送信者と受信者の間にファイアウォールがある場合は、アイドルタイムアウトのために接続を閉じていないことを確認してください。私は過去にこの2つの問題を抱えていましたが、一般的なソケットプログラミングではDBのものではありませんでした。

+0

入力のために感謝するでしょう、私は本当のデフォルトに設定していますが、それらをオフにするポストを読んで、私はタイムアウトを調べようとしますファイアウォール ありがとう – TheCodeFool

関連する問題