我试图弄清楚将这个物体推到哪里:
ServiceThrottlingBehavior stb = new ServiceThrottlingBehavior
{
MaxConcurrentSessions = 100,
MaxConcurrentCalls = 100,
MaxConcurrentInstances = 100
};
我在 web.config 中找到了有关如何配置它的信息,但对此我有点困惑。我们曾经在我们的 web.config 中有一些看起来像这样的东西:
<service name="AuthenticationService.AuthenticationService" behaviorConfiguration="Development">
<endpoint address="http://services.local/0.0.0.5/AuthenticationService.svc"
binding="basicHttpBinding"
bindingConfiguration="TUPSOAPBinding"
contract="AuthenticationService.ServiceDomain.ISecurityService"
name="SOAPCatalogService" />
</service>
如果我们仍然使用它,我将确切地知道如何通过 web.config 配置节流,但我们发现我们可以将所有这些端点从 web.config 中取出,并且一切仍然有效,并且由于我们没有这样做,因此维护较少不得不去更新不同版本和环境的地址了。
我还找到了有关如何在 ServiceHost 上以编程方式设置它的信息,但我没有以编程方式创建 ServiceHost。我让 IIS 来处理这个问题。
那么有没有一种编程方式可以让我在没有 web.config 并且不必自己创建 ServiceHost 的情况下设置节流?
编辑:或者有没有办法让我在 web.config 中做到这一点,而不必为<service />
我们的每一项服务创建一个条目?