Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在生产和QA上获取WCF服务的意外关闭错误_C#_Asp.net_.net_Wcf_Web Services - Fatal编程技术网

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

C# 在生产和QA上获取WCF服务的意外关闭错误,c#,asp.net,.net,wcf,web-services,C#,Asp.net,.net,Wcf,Web Services,我正在连接一家公司创建的验证电子邮件的web服务。当我在本地运行时,我没有收到任何错误,但当我将模块上载到QA和生产计算机时,我收到了一个超时,我将超时从00:01:00增加到00:05:00,现在我收到了错误: 基础连接已关闭:server.mscorlibVoid HandleReturnMessage(System.Runtime.Remoting.Messaging.IMessage,System.Runtime.Remoting.Messaging.IMessage)服务器堆栈跟踪关闭

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

基础连接已关闭:server.mscorlibVoid HandleReturnMessage(System.Runtime.Remoting.Messaging.IMessage,System.Runtime.Remoting.Messaging.IMessage)服务器堆栈跟踪关闭了预期保持活动状态的连接:位于System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebExceptionSystem.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan超时)System.ServiceModel.Channels.RequestChannel.RequestChannel.request(消息消息,TimeSpan超时)System.ServiceModel.Channels.ServiceChannel.Call中的(WebException WebException WebException,HttpWebRequest request,HttpBortreason abortReason)在System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime操作)的System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime操作)、Object[]In、Object[]outs、TimeSpan timeout)异常在[0]处重试:在System.Runtime.Remoting.Proxy.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)在System.Runtime.Remoting.Proxy.RealProxy.PrivateInvoke(MessageData&msgData,Int32类型)在Redacted.Common.SI.EmailVerificationSoap.VerifyEmail(VerifyEmailRequest请求)在Redacted.Common.SI.EmailVerificationSoapClient.Redacted.Common.SI.EmailVerificationSoap.VerifyEmail(VerifyEmailRequest请求)在Redacted.Common.SI.EmailVerificationSoapClient.VerifyEmail(LicenseInfo LicenseInfo、字符串电子邮件、Int32超时、SiwsOutputForVerifyEmailRecord和VerifyEmailResult)在Redacted.WindowServices.Form3.RunSpFirstTime()的Redacted.Common.ValidationHelper.ValidateEmailByService(字符串电子邮件)中,基础连接已关闭:系统.Net.HttpWebRequest.GetResponse()中的server.SystemSystem.Net.WebResponse GetResponse()关闭了预期保持活动状态的连接在System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(时间跨度超时)无法从传输连接读取数据:远程主机强制关闭了现有连接。System.Net.Sockets.NetworkStream.read(字节[]处的SystemInt32 read(字节[],Int32,Int32)在System.Net.Connection.SyncRead(HttpWebRequest请求,Boolean userRetrievedStream,Boolean ProberRead)中,System.Net.PooledStream.Read(字节[]缓冲区,Int32偏移量,Int32大小)处的缓冲区,Int32大小)远程hostSystemInt32读取(字节[],Int32,Int32)强制关闭现有连接位于System.Net.Sockets.NetworkStream.Read(字节[]缓冲区,Int32偏移量,Int32大小)

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

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;
         }
使用(SI.EmailVerificationSoapClient=new EmailVerificationSoapClient())
{
var customBinding=新的customBinding(client.Endpoint.Binding);
var transportElement=customBinding.Elements
.Find();
transportElement.KeepAliveEnabled=false;
client.Endpoint.Binding=customBinding;
LicenseInfo authHeader=新LicenseInfo();
RegisteredUser regUser=新的RegisteredUser
{
UserID=ConfigurationHelper.GetValue(“SIUsername”),
Password=ConfigurationHelper.GetValue(“SIPassword”)
};
authHeader.RegisteredUser=regUser;
SIWSOUTPUTOFVERIFYEMAIL记录结果;
客户端验证电子邮件(authHeader,电子邮件,60,输出结果);
布尔哈苏塞德=
result.ServiceStatus.StatusNbr==200||
result.ServiceStatus.StatusNbr==202 | |
result.ServiceStatus.StatusNbr==203;
client.Close();
返回hassucceed;
}
请注意,我已将
保持活动状态
设置为false,并根据我在其他论坛上阅读的有关此问题的建议创建和处理每次呼叫的客户端,但它仍然不起作用

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


还有什么我可以做的吗?

服务上运行的代码是什么?您是否希望它需要超过一分钟的时间?如果不是,服务中的其他事情可能是问题的根源?它不应该超过一分钟,我添加了超时,只是为了看看它是否可以工作,我得到了一个不同的错误Message我的猜测是,您已经设法将一个问题转移到另一个网络超时来掩盖它。问题在于服务内部发生了什么,所以需要很长时间。如果您在服务中打开跟踪,您是否看到了什么?您不应该使用块将WCF代理放入
。请参阅我同意Richard的观点-s中的某些内容服务所用的时间比您预期的要长。看看您的环境-您说过它在本地运行,但在QA或生产环境中不起作用。您的本地机箱与其他两个环境有什么不同?这可能会让您了解是什么原因导致您的服务运行时间比预期的长。