Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/algorithm/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WCF单一服务实施-多种行为_Wcf - Fatal编程技术网

WCF单一服务实施-多种行为

WCF单一服务实施-多种行为,wcf,Wcf,我有一个IIS托管的WCF服务,我需要将其公开给两种客户机类型:外部(basicHttp legacy)和内部(wsHttp WCF)。对于外部客户机,我希望实施更严格的限制配置。似乎节流配置如下所示: <serviceThrottling maxConcurrentCalls="30" maxConcurrentSessions="1000" maxConcurrentInstances="30" /> 只能作为服务行为而不是端点行为应用。

我有一个IIS托管的WCF服务,我需要将其公开给两种客户机类型:外部(basicHttp legacy)和内部(wsHttp WCF)。对于外部客户机,我希望实施更严格的限制配置。似乎节流配置如下所示:

<serviceThrottling 
     maxConcurrentCalls="30" 
     maxConcurrentSessions="1000" 
     maxConcurrentInstances="30" />

只能作为服务行为而不是端点行为应用。这意味着我需要创建两个单独的.svc文件,它们将解析为同一个.cs文件,如下所示:

<service behaviorConfiguration="x.xServiceBehavior">
     <endpoint 
          address="~/xService.svc" 
          binding="wsHttpBinding" 
          contract="xService.IxService"/>
</service>

<service behaviorConfiguration="xService.ThrottledxServiceBehavior">
     <endpoint 
          address="~/ThrottledxService.svc" 
          binding="basicHttpBinding" 
          contract="x.xService.IxService"/>
</service>

这是实现我追求的目标的最佳方式还是有更好的方式

谢谢


Rob。

您所采用的方法看起来是正确的,可以为两个不同的绑定实现不同的服务行为配置。在避免使用两个.svc文件的同时,也可以达到同样的效果,但是上面的方法可以很好地工作,所以为什么要这么做呢!:)