wcf 中客户端调用之死 感悟 wcf与原来的webservice2.0 的客户端调用区别(wcf调用完不关闭的话那就把web服务搞死了)
说到wcf,本人也是刚刚使用所以不是很熟悉
在做项目的时候采用webservice+客户端程序架构
写了一个wcf中的webservice之后,又写了很多的客户端exe程序,有的是轮询调用这个webservice方法,有的是仅仅调用一次webservice方法的exe程序,
在单元测试的时候都是没有遇到问题,结果却在做整合测试的时候发现发现了如下的错误,倒是所有程序都不能正常运行:
System.TimeoutException: The request channel timed out while waiting for a reply after 00:01:00. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout. ---> System.TimeoutException: The HTTP request to 'http://192.168.3.112:8080/Service.svc' has exceeded the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout. ---> System.Net.WebException: The operation has timed out
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
--- End of inner exception stack trace ---
at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
--- End of inner exception stack trace ---
Server stack trace:
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ClientReliableChannelBinder`1.RequestClientReliableChannelBinder`1.OnRequest(TRequestChannel channel, Message message, TimeSpan timeout, MaskingMode maskingMode)
at System.ServiceModel.Channels.ClientReliableChannelBinder`1.Request(Message message, TimeSpan timeout, MaskingMode maskingMode)
at System.ServiceModel.Channels.ClientReliableChannelBinder`1.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.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.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
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 PortalClient.SvcRef.IService.GetExcelToTxt()
at PortalClient.SvcRef.ServiceClient.GetExcelToTxt() in D:\MAXNET_PROJECT\03_SourceCode\MAXNET\05_MaximOOS\MaximOOS\Maxim.PortalClient\Service References\SvcRef\Reference.cs:line 2653
at Maxim.PortalClient.SrvBox.btnTestWriteTxt_Click(Object sender, EventArgs e) in D:\MAXNET_PROJECT\03_SourceCode\MAXNET\05_MaximOOS\MaximOOS\Maxim.PortalClient\SrvBox.cs:line 26
看了上面的错误,估计大家都应该知道是什么错误了吧,对,是调用超时。
当时看到这个错误,我的第一反应就是可能传输的问题,但是代码没有问题,因此我就修改了客户端调用webservice的响应时间改成5分钟,结果令人不满意,还是不行
后来我就试了一下重启iis结果,我发现在第一次调用webservice的时候成功了,但是在随后的调用中又出现了上面的错误,但是真的差点崩溃了,
一直到加班结束,我在回家的路上突然想到了我以前遇到超时的问题是数据库连接超时,是因为连接打开然后没有关闭,导致数据打开的连接数超过上限以致超时的,
回到家后我立即采用简单的测试,终于发现了在wcf中的webservice也是要关闭的(其实在示例代码中有说要close()的,可是我没注意),如果不关闭的话,我测试了一下,档调用webservice超过10次的时候,webservcie就死掉了,以致以后再调都不可以了(这个会不会是微软的bug呀,因为如果这种问题出现的话,要想让webservice死掉的话,我只有调用webservice然后不做关闭处理就可以实现了),这个和以前的webservice(asmx)方案是完全不一样的,webservice(asmx)不需要关闭
还有我发现调用wcf写的服务没有调用webservice(asmx)的速度开,性能可能wcf没有webservice(asmx)好,但是可靠性应该还可以的
这个是小弟的第一篇blog,谢谢支持!
wcf 中客户端调用之死 感悟 wcf与原来的webservice2.0 的客户端调用区别(wcf调用完不关闭的话那就把web服务搞死了)的更多相关文章
- windows环境下解决web服务假死的问题
最近在windows系统在部署web服务器,发现很不稳定.web服务有容易假死,改过配置换过各种web软件,如apache.nginx都不管用. 所以干脆做个简易的定时检测Web服务状态的软件.一旦w ...
- WCF中的标准绑定
使用过WCF的童鞋们都很清楚,绑定是必须的.我将这些绑定总结了下. 一.标准绑定简要说明 1.basicHttpBinding 基于WS-I Basic Profile 1.1 的web服务,所需的. ...
- 跟我一起学WCF(10)——WCF中事务处理
一.引言 好久没更新,总感觉自己欠了什么一样的,所以今天迫不及待地来更新了,因为后面还有好几个系列准备些,还有很多东西需要学习总结的.今天就来介绍下WCF对事务的支持. 二.WCF事务详解 2.1 事 ...
- WCF中事务处理
一.引言 今天来介绍下WCF对事务的支持. 二.WCF事务详解 2.1 事务概念与属性 首先,大家在学习数据库的时候就已经接触到事务这个概念了.所谓事务,它是一个操作序列,这些操作要么都执行,要么都不 ...
- mvc路由引起异步调用web服务的问题
从一篇blog得知使用脚本可以异步调用Web服务,觉得很新鲜,因为自己很少用到Web服务,所以决定写一写看看什么效果. 首先在UI项目(我使用的是MVC4.0)里创建一个Web服务. 添加Web服务后 ...
- 动态的调用服务端的WCF中的方法
客户端调用wcf ,有时需要动态的调用服务端的WCF中的方法,本方法,反射wcf 的接口,动态调用接口中的方法. 主要为,动态绑定,反射动态调用. public static object Execu ...
- ajax调用本地wcf中的post和get
我们可以通过jQuery调用本地或者远程的wcf服务,本文讲解的是对本地wcf服务的post和get调用方式. post和get到底有什么区别呢?此处不作详述. 但是,post对请求的数据格式更为严格 ...
- WCF中修改接口或步骤名称而不影响客户端程序
WCF中修改接口或方法名称而不影响客户端程序 本篇接着"从Web Service和Remoting Service引出WCF服务"中有关WCF的部分. 运行宿主应用程序. 运行We ...
- WCF学习之旅—WCF中传统的异常处理(十六)
WCF中的异常处理 在软件开发过程中,不可能没有异常的出现,所以在开发过程中,对不可预知的异常进行解决时,异常处理显得尤为重要.对于一般的.NET系统来说,我们简单地借助try/catch可以很容易地 ...
随机推荐
- Spring(八):Spring配置Bean(一)BeanFactory&ApplicationContext概述、依赖注入的方式、注入属性值细节
在Spring的IOC容器里配置Bean 配置Bean形式:基于xml文件方式.基于注解的方式 在xml文件中通过bean节点配置bean: <?xml version="1.0&qu ...
- SharePoint 2010/2013: List view Lookup threshold uncovered
SharePoint with Large lists is common scenario in any Sharepoint deployment. While there are Several ...
- 详解Nginx + Tomcat 反向代理 如何在高效的在一台服务器部署多个站点
转自:http://www.jb51.net/article/100111.htm 首先我们需要安装好Nginx.jdk.Tomcat,安装方法已经在 上一篇 说过了,本篇不再赘述. 下来看一下我们的 ...
- ThinkPHP3.0启动过程
以Blog举例载入项目入口文件 D:\wamp\www\Examples\Blog\index.php 定义常量 APP_NAME,Blog APP_P ...
- java语言特性之一
package java.util.Collections; public static int indexOfSubList(List<?> source, List<?> ...
- ASP.NET绑定学习
1.直接绑定到页面成员<asp:Repeater ... DataSource='<%#页面方法或属性%>'></asp:Repeater> 2.绑定到数组< ...
- LintCode: Longest Words
C++ class Solution { public: /** * @param dictionary: a vector of strings * @return: a vector of str ...
- Lintcode: Add Two Numbers
C++ /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * List ...
- Oracle 定时任务使用
1:首先创建存储过程 create or replace procedure pro_rqsl_hmd is rsCursor sys_refcursor; rqslid ); nsrsbh ); h ...
- jstat 使用日志
如何判断JVM是否存在内存问题呢?如何判断JVM垃圾回收是否正常?一般的top指令基本上满足不了这样的需求,因为它主要监控的是总体的系统资源,很难定位到java应用程序. Jstat是JDK自带的一个 ...