WCF内存使用情况 [英] WCF memory usage

查看:178
本文介绍了WCF内存使用情况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IIS中使用net.tcp绑定托管了WCF服务,并配置了PerCall实例化.出于测试目的,我只有一个操作完全不执行任何操作.

I have a WCF service hosting in IIS using net.tcp binding and configured for PerCall instancing. For test purposes, I have a single operation that does absolutely nothing.

每次客户端连接并调用该操作时,w3wp.exe进程的内存使用量都会增加,并且在客户端关闭连接后,内存使用量不会减少.反复调用后,内存已从最初的20MB增加到500MB或更多.

Every time a client connects and calls the operation, memory usage increases for the w3wp.exe process and after the client has closes the connection, the memory usage does not decrease. After repeated calls, the memory has increased from an initial 20MB to 500MB or more.

这是正常行为吗?

推荐答案

以PerCall实例上下文模式调用服务时,应在方法返回后释放内存.由于在您的方案中没有发生这种情况,请尝试在您的服务上实现IDisposable接口,以便能够明确控制服务的处置.另外,请确保在使用后立即在客户端上关闭代理连接.

When you call a service with PerCall Instance Context mode then the memory should be released after the method returns. Since that is not happening in your scenario, try to implement the IDisposable interface on your services to be able to control the disposal of your services explicitly. Also make sure that you close your proxy connections on the client right after usage.

这篇关于WCF内存使用情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆