WCF“;太多积极的安全谈判”;生产错误
我们有一个WCF服务,超过100个客户端站点可以呼叫。今天我们开始得到WCF“;太多积极的安全谈判”;生产错误,wcf,exception,config,Wcf,Exception,Config,我们有一个WCF服务,超过100个客户端站点可以呼叫。今天我们开始得到 Exception: Server 'http://[url]/services/[service].svc/ws' sent back a fault indicating it is too busy to process the request. Please retry later. Please see the inner exception for fault details. System.Serv
Exception: Server 'http://[url]/services/[service].svc/ws' sent back a
fault indicating it is too busy to process the request. Please retry later. Please see the
inner exception for fault details.
System.ServiceModel.FaultException: There are too many active security negotiations or
secure conversations at the service. Please retry later.
我能找到的唯一信息是,我需要将maxPendingSessions
放大。但这需要将端点更改为CustomBinding,这将很困难,因为我必须将其推送到所有客户端站点
有没有什么方法可以让我“重置”安全谈判的次数?这将使我们有时间更改客户端程序以使用自定义绑定,因为目前,我们的站点无法与服务器通信。我尝试过对配置文件做一个小的更改并保存,这应该会重新启动服务,但仍然会出现错误 或者我还有别的办法来处理这件事吗 编辑这是我的配置:
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data"/>
</configSections>
<connectionStrings>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Error" propagateActivity="true">
<listeners>
<add name="xml" />
</listeners>
</source>
</sources>
<sharedListeners>
<add name="xml" type="System.Diagnostics.XmlWriterTraceListener" initializeData="D:\logs\log.txt" />
</sharedListeners>
</system.diagnostics>
<system.serviceModel>
<diagnostics performanceCounters="All" />
<services>
<service name="WCFServiceLibrary.WCFService">
<endpoint address="ws" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IWCFService"
name="WSHttpEndpoint_IWCFService" contract="WCFServiceLibrary.IWCFService" />
<endpoint address="basic" binding="basicHttpBinding"
name="BasicHttpEndpoint_IWCFService" contract="WCFServiceLibrary.IWCFService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IWCFService"
maxBufferPoolSize="524288" maxReceivedMessageSize="1048576">
<readerQuotas maxDepth="32" maxStringContentLength="65536" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Message">
<message clientCredentialType="Certificate" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceCredentials>
<serviceCertificate findValue="CN=[url]" storeLocation="LocalMachine" storeName="TrustedPeople" />
<clientCertificate>
<authentication revocationMode="NoCheck" certificateValidationMode="PeerTrust" />
</clientCertificate>
</serviceCredentials>
<serviceThrottling maxConcurrentCalls ="1001" maxConcurrentSessions="1001" maxConcurrentInstances="1000" />
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
</configuration>
编辑我们尝试了一个
iisreset
,甚至重新启动了服务器,但它仍然抛出相同的错误。既然您似乎没有使用自定义服务工厂,那么您就没有创建托管在IIS中的单例服务。问题可能与将服务设置为运行多线程有关。除非服务包含依赖/管理多线程的代码,否则应将服务实例配置为单线程。设置ConcurrencyMode=Single并从配置中删除servicetrottling元素,以便为这些设置使用内置的WCF默认值。如果例外消失了,那么你就完蛋了。否则,您将知道这不是多线程配置或服务限制设置。
问题是创建客户机但不使用它(不调用它上的任何方法)
我花了4天的时间在.NET4.0中对此进行了研究,以意识到它不是固定的
复制很容易:
ChannelFactory<IFoo> foo = new ChannelFactory<IFoo>("binding");
foo.Open();
foo.Close();
ChannelFactory foo=新的ChannelFactory(“绑定”);
foo.Open();
foo.Close();
在128次呼叫后,您会得到错误信息
我不知道为什么它不是固定的,但是解决方案是在您确定需要调用代理时创建代理。增加maxPending非常有用,因为您可能仍然会遇到问题。听起来您有一个带有某种会话约束的单例服务。如果您在问题中提供有关服务合同设置和配置的信息,这将有所帮助。@Sixto是的。它托管在IIS中。我已添加配置。回收应用程序池将回答您的重置问题,但不会解决您的问题。您的问题可能是由应用程序以外的其他因素造成的,因为您正在使用证书。您的CA设置如何?在您的回复中,您似乎在说它是IIS中托管的单例服务。您显示的配置不是单例配置。是使用自定义服务工厂在IIS中实例化服务,还是仅使用为服务设置的标准IIS?另外,最好知道您是否正在服务合同中设置ConcurrencyMode和InstanceContextMode属性值。@Frode我已回收了正确的应用程序池,客户端仍在抛出错误。我使用的是自签名CA,但我认为这不是问题所在,因为在过去的几个月里,直到今天,一切都正常。这可能是由于我使用同一应用程序池的另一个服务造成的吗?设置ConcurrencyMode=Single是否会限制我一次只能打一个电话?这将不能很好地扩展,我不希望我的客户端必须等待其他人使用IIS完成.WCF,并且您在问题中的配置将在每个WCF会话(完全独立于ASP.NET会话)中启动一个服务实例。这是WCF会话的详细概述。每次呼叫或每次会话InstanceContextMode设置都具有很强的可伸缩性。ConcurrencyMode控制的是是否允许每个服务实例都是多线程的。当您确定需要调用代理时,如何创建代理?我也有同样的问题,你的帖子很有希望,但同时也令人沮丧。