希望我对WCF数据量的一点经验能给大家带来帮助,下面通过IIS服务器的真实处理,以及代码和异常的使用问题,进行解释说明,下面就把编制的代码一一列数下来,欢迎大家学习研究。
昨天下午在作WCF数据量并发的测试,同时启动40个客户端进程,在碰到比较耗时的服务处理时,IIS服务器返回403错误。异常信息如下:]
- System.ServiceModel.Security.MessageSecurityException: System.Net.HttpWebRequest.GetResponse()
- System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
- Server stack trace:
- System.ServiceModel.Channels.HttpChannelUtilities.ValidateAuthentication(HttpWebRequest request, HttpWebResponse response,
WebException responseException, HttpChannelFactory factory)- System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request,
HttpWebResponse response, HttpChannelFactory factory, WebException responseException)- System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.
WaitForReply(TimeSpan timeout) System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)- System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
- System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
- System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
- System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
- System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
- Exception rethrown at [0]:
- System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
- System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
- terminal.ViolationService.IViolationService.QueryVioImg(String vioSeq)
- terminal.ViolationService.ViolationServiceClient.QueryVioImg(String vioSeq),terminal.Program.Main(String[] args)
通过各种方法监控WCF数据量的错误消息,可是这些出错的调用都没有到达WCF,所有监测WCF的地方和WCF的TraceLog都没有任何的错误。随后又拿出***法宝wireshark,抓包也看不到任何错误,就是客户端请求了服务器一下,然后IIS就返回了403错误,并报告上面的异常。#t#
于是把WCF的服务部署到了Win2003server的iis6下面。这样程序正常运行不会有任何错误。于是查了一下IIS5.1 造成403错误的原因。原来是IIS5.1的***连接数的问题。于是总结了一下:
同时修改了几个方面:
1.windowsXP SP3的TCP连接数,改为512。(有专门的工具破解)
2.WCF数据量会话数,调用数和实例数