在生产和QA上获得WCF服务的意外关闭错误

时间:2012-01-22 10:58:09

标签: c# asp.net .net wcf web-services

我正在连接由验证电子邮件的公司创建的网络服务。当我在本地运行时,我没有收到任何错误,但当我将模块上传到我的QA和生产计算机时,我正在超时,我将超时从00:01:00增加到00:05:00现在我得到错误:

基础连接已关闭:服务器已关闭预期保持活动状态的连接.mscorlibVoid HandleReturnMessage(System.Runtime.Remoting.Messaging.IMessage,System.Runtime.Remoting.Messaging.IMessage)服务器堆栈跟踪:System.ServiceModel.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException,HttpWebRequest请求,HttpAbortReason abortReason)at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)at System.ServiceModel.Channels.RequestChannel System.ServiceModel.Channels.ServiceChannelProxy的System.ServiceModel.Channels.ServiceChannel.Call(String action,Boolean oneway,ProxyOperationRuntime operation,Object [] ins,Object [] outs,TimeSpan timeout)的.Request(消息消息,TimeSpan超时) System.ServiceModel.Channels.ServiceChannelProxy.Invoke中的.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime操作)(IMessage me ssage)在[0]处重新发生异常:在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData,Int32类型)位于Redacted.Common.SI.EmonVelificationSoapClient上的Redacted.Common.SI.EmailVerificationSoapClient.Redacted.Common.SI.EmailVerificationSoap.VerifyEmail(VerifyEmailRequest请求)中的Redacted.Common.SI.EmailVerificationSoap.VerifyEmail(VerifyEmailRequest请求)。在Redacted.WindowServices.Form3.RunSpFirstTime()的Redacted.Common.ValidationHelper.ValidateEmailByService(String email)上验证电子邮件(LicenseInfo LicenseInfo,String Email,Int32 Timeout,SIWsOutputOfVerifyEmailRecord& VerifyEmailResult)基础连接已关闭:预期的连接system.SystemSystem.Net.WebResponse GetResponse()在System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan超时)中的System.Net.HttpWebRequest.GetResponse()处关闭了.SystemSystem.Net.WebResponse GetResponse()无法从中读取数据传输连接:远程host.SystemInt32在S处强制关闭现有连接(Byte [],Int32,Int32) System.Net.Connection.SyncRead上的System.Net.PooledStream.Read(Byte []缓冲区,Int32偏移量,Int32大小)的ystem.Net.Sockets.NetworkStream.Read(Byte []缓冲区,Int32偏移量,Int32大小) HttpWebRequest请求,Boolean userRetrievedStream,Boolean probeRead)远程hostSystemInt32 Read(Byte [],Int32,Int32)在System.Net.Sockets.NetworkStream.Read(Byte []缓冲区,Int32偏移量,Int32大小)强制关闭现有连接)

以下是我连接到网络服务的代码:

using (SI.EmailVerificationSoapClient client = new EmailVerificationSoapClient())
        {

         var customBinding = new CustomBinding(client.Endpoint.Binding);
         var transportElement = customBinding.Elements
                      .Find<HttpTransportBindingElement>();
         transportElement.KeepAliveEnabled = false;

         client.Endpoint.Binding = customBinding;
         LicenseInfo authHeader = new LicenseInfo();

         RegisteredUser regUser = new RegisteredUser
           {
           UserID = ConfigurationHelper.GetValue("SIUsername"),
            Password = ConfigurationHelper.GetValue("SIPassword")
           };
         authHeader.RegisteredUser = regUser;
         SIWsOutputOfVerifyEmailRecord result;
         client.VerifyEmail(authHeader, email, 60, out result);
         bool hasSucceeded = 
    result.ServiceStatus.StatusNbr == 200 ||
     result.ServiceStatus.StatusNbr == 202 ||  
    result.ServiceStatus.StatusNbr == 203;
         client.Close();
         return hasSucceeded;
         }

请注意,我已将Keep Alive设置为false,并根据我在其他论坛上就此问题阅读的建议创建并处置客户端,但仍然无法正常工作。

我添加了一个跟踪器并读取跟踪日志并且没有信息,它只显示我粘贴在上面的相同错误。我在reference.cs文件中找不到webrequest来将其更改为keep-alive(这是一个wcf服务)而且我只是在生产中遇到这个错误 和qa,而不是我的本地机器。

我还能做些什么吗?

0 个答案:

没有答案