我们有一个 WCF 服务作为 BL 服务。该服务处于混合传输模式,具有 10 多个不同的端点,由 BasicHttpBinding 绑定,它们具有不同的合同和相同的地址。该服务在 IIS-7 上的应用程序池上运行。
问题是,服务运行正常,但第一次调用后,即使获取到WSDL,w3wp.exe的内存使用量直接达到300兆,服务内存使用量不断增加,占据了所有物理内存服务器 (98 - 100 %)。我们没有出现内存不足异常,但是这种情况会减慢其他应用程序和服务的速度,因此我们需要每隔几天手动刷新一次应用程序池。我已经尝试使用内存分析工具,但没有找到任何导致问题的原因。
有没有人遇到过这个问题?如果是,你做了什么?
附加信息:
- BL 服务位于基于 NHibernate 的 DAL 框架之上,我们已经排除了内存泄漏源自那里。
配置文件
<?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> </appSettings> <system.web> <compilation debug="true" targetFramework="4.0" /> <httpRuntime maxRequestLength="20000" requestLengthDiskThreshold="20000" /> </system.web> <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="DefaultServiceBehavior"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> <endpointBehaviors> <behavior name="AnonymousBehavior"> </behavior> </endpointBehaviors> </behaviors> <bindings> <basicHttpBinding> <binding name="SecureBinding" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="true" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536000" maxBufferPoolSize="524288000" maxReceivedMessageSize="65536000" transferMode="Buffered"> <readerQuotas maxDepth="20000000" maxStringContentLength="8192000" maxArrayLength="16384000" maxBytesPerRead="4096000" maxNameTableCharCount="16384000" /> <security mode="None"> <transport clientCredentialType="None"/> </security> </binding> </basicHttpBinding> </bindings> <services> <service name="BL.Services.MyService" behaviorConfiguration="DefaultServiceBehavior"> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="SecureBinding" bindingNamespace="Security/Anonymous" behaviorConfiguration="WithSecurityContextInspector" contract="BL.Services.Contracts.IAnonymousClaimsService" /> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="SecureBinding" bindingNamespace="Domain/App" behaviorConfiguration="WithSecurityContextInspector" contract="BL.Services.Contracts.IAppService" /> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="SecureBinding" bindingNamespace="Domain/App" behaviorConfiguration="WithSecurityContextInspector" contract="BL.Services.Contracts.IAttachmentService" /> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="SecureBinding" bindingNamespace="Domain/Site" behaviorConfiguration="WithSecurityContextInspector" contract="BL.Services.Contracts.ISecurityService" /> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="SecureBinding" bindingNamespace="Domain/Transaction" behaviorConfiguration="WithSecurityContextInspector" contract="BL.Services.Contracts.ITransactionService" /> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="SecureBinding" bindingNamespace="Domain/ActiveDirectory" behaviorConfiguration="WithSecurityContextInspector" contract="BL.Services.Contracts.IActiveDirectoryService" /> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="SecureBinding" bindingNamespace="Domain/Report" behaviorConfiguration="WithSecurityContextInspector" contract="BL.Services.Contracts.IReportService" /> <host> <baseAddresses> <add baseAddress="//MyService.svc" /> </baseAddresses> </host> </service> </services> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true" /> <defaultDocument> <files> <add value="MyService.svc" /> </files> </defaultDocument> </system.webServer> </configuration>