2011-09-29 116 views
0

我有一个运行在IIS 7(Windows Server 2008)上的WCF 4服务,部署到开发服务器。当我运行一个使用该服务的小型网站(点击一个按钮,该页面调用该服务,数据被返回,这是非常基本的)时,该服务起作用。如何解决负载测试失败的WCF服务?

我还创建了一些调用服务的单元测试,并将它们放入负载测试中。简而言之,“单元测试”调用该服务并将从服务流回的byte[]写入文件。运行负载测试时,服务按预期执行。

问题是在极少数迭代后负载测试失败。有时候拨打电话是成功的,其他时间在五次电话之后。再次单独地,测试运行良好,但是当我将它们放在一起以模拟实时环境(多个用户,多次测试迭代)时,会出现此问题。

引发的异常是:

Test method TestProject1.UnitTest1.RunReport threw exception: 
System.ServiceModel.CommunicationException: 
An error occurred while receiving the HTTP response to http://xx.xx.xx.xx:yy/Service.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host 

更新#1: 我只设置测试迭代10(运行测试10X)和恒定用户负载为1。试验是能够完成成功。这是使用最基本的单元测试。第二个更复杂的测试在本次测试中被忽略。

回答

1

查看您的应用程序事件日志(eventvwr.exe)。假设你在一个大部分正常的环境中运行,那么会出现服务器端错误的条目。