2013-08-01 3 views
0

타사 asmx 서비스에 액세스하려고합니다 (내 ASP.Net MVC 4 응용 프로그램에서). 대부분 괜찮 으면 오류가 발생하기 시작합니다..Net SoapClient 연결이 닫히지 않았 음

The connection was not closed. The connection's current state is open. 

이 문제는 잠시 사라져 모든 것이 잘 작동합니다. 그런 다음 다시 나타납니다.

프록시 또는 네트워크 설정이 의심 스럽지만이를 변경하면 도움이되지 않습니다. 문제없이 서비스 참조를 업데이트 할 수 있으므로 서비스에 올바르게 액세스 할 수 있습니다.

서비스 끝에서이 오류가 발생하여 내 앱에 버블 링 될 수 있습니까?

문제가 클라이언트 측인지 내 문제인지 확인할 수 있습니까?

감사

세부 사항 :

[System.ServiceModel.FaultException]: {"Server was unable to process request. ---> The connection was not closed. The connection's current state is open."} 

Server stack trace: 
    at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) 
    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 MyTDI.ClientWebServices.TDIWS_SalesManagement.WS_SalesManagementModuleSoap.GetAgentCommissions(String Agency_RegNo, DateTime StartDate, DateTime EndDate, Int32 PageNo) 
    at MyTDI.ClientWebServices.TDIWS_SalesManagement.WS_SalesManagementModuleSoapClient.GetAgentCommissions(String Agency_RegNo, DateTime StartDate, DateTime EndDate, Int32 PageNo) in d:\Projects\TPLTDI\MyTDIPortal\MyTDI.ClientWebServices\Service References\TDIWS_SalesManagement\Reference.cs:line 111 
    at MyTDI.ClientWebServices.Sales.SalesManagementWebService.ListAgentCommissions(String agentId, DateTime startDate, DateTime endDate, Int32 pageNo) in d:\Projects\TPLTDI\MyTDIPortal\MyTDI.ClientWebServices\Sales\SalesManagementWebService.cs:line 31 

코드

  DataSet ds = null; 
     using(WS_SalesManagementModuleSoapClient client = new WS_SalesManagementModuleSoapClient()) 
     { 
      try 
      { 
       ds = client.GetAgentCommissions(agentId , startDate , endDate , pageNo); 
      } 
      catch(Exception ex) 
      { 
       logger.Error(ex , ""); 
       throw new Exception("Unable to obtain commissions data from server."); 
      } 
     } 
+1

데이터베이스 연결에 오류가 발생합니다. 'SqlConnection' 객체가 서버 코드 ('using' 문)에 적절하게 처리되었는지 확인하십시오. –

+0

그래서 웹 서비스 소유자에게 코드를 확인하도록 요청해야합니까? –

+0

확실히 그렇게하십시오. –

답변

0

오류는 데이터베이스 연결에서 발생합니다. SqlConnection 개체가 서버 코드에 올바르게 처리되었는지 확인하십시오. using 문을 사용하여 코드를 래핑하는 것이 좋습니다.

관련 문제