WCF 在负载下失败 - MessageSecurityException
我正在对我的网站进行负载测试。 该站点使用 clientCredentialType="Windows" 调用在同一机器上运行的 WCF 服务。 一切正常,直到我达到一定的负载(甚至不是很高),然后我收到以下错误:
System.ServiceModel.Security.MessageSecurityException: HTTP 请求被禁止 客户端认证方案 '匿名的'。 ----> System.Net.WebException:远程 服务器返回错误:(403) 禁止。
每次调用时,我都会创建一个通道:
var proxy = (IClientChannel)channelFactory.CreateChannel();
成功时,我关闭:
proxy.Close();
出错时,我中止:
proxy.Abort();
知道发生了什么吗? 我可以做些什么来更好地处理负载? 要找什么?
I am load testing my website. The site calls to a WCF service running on the same box using clientCredentialType="Windows". Everything works until I reach a certain load (which is not even very high), then I get the following error:
System.ServiceModel.Security.MessageSecurityException:
The HTTP request was forbidden with
client authentication scheme
'Anonymous'. ---->
System.Net.WebException: The remote
server returned an error: (403)
Forbidden.
Upon each call I create a channel:
var proxy = (IClientChannel)channelFactory.CreateChannel();
On success, I close:
proxy.Close();
On error, I abort:
proxy.Abort();
Any ideas what's going on? What I can do to handle loads better? What to look for?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的服务是会话服务还是您不担心在调用之间保持状态? 如果您没有状态,您可能希望将您的服务标记为 PerCall 服务。 这将确保服务实例仅在客户端调用正在进行时存在。
Juval Lowy 的优秀著作《Programming WCF Services》第二版的第 4 章涵盖了这个主题。
默认值是 PerSession,这可能不是您想要的。
另请参阅 MSDN:操作方法:控制服务实例
Is your Service a Sessionful Service or do you not worry about keeping state between calls? If you don't have state, you may want to mark your service as a PerCall service. This will make sure that the service instance only exists when a client call is in progress.
Chapter 4 of Juval Lowy's excellent book "Programming WCF Services" 2nd Edition covers this topic.
The default is PerSession which may not be what you want.
Also, see this on MSDN: How To: Control Service Instancing
谢谢特里。 不,我的服务不维护状态。 我尝试用以下内容装饰我的服务类:
没有帮助。 故障点似乎是在大约 4 个并发调用处。
Thanks Terry. No my service does not maintain state. I tried decorating my service class with:
No help. The failure point seems to be at about 4 concurrent calls.
问题是,呃,我在我的开发盒上运行测试,它是 XP,它使用 IIS 5,它的连接数限制为 10 个。
The problem was, argh, that I was running the test on my dev box, which is XP, which uses IIS 5, which has a limit of 10 connections.