1
目前我在单个服务中有几个端点调用相同的操作,但根据其优先级调用不同的调节配置。WCF服务中的优先顺序
<serviceBehaviors>
<behavior name="PriorityService1">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="3" maxConcurrentSessions="3"
maxConcurrentInstances="3" />
</behavior>
<behavior name="PriorityService2">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="5" maxConcurrentSessions="5"
maxConcurrentInstances="5" />
</behavior>
<behavior name="PriorityService3">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="10" maxConcurrentSessions="10"
maxConcurrentInstances="10" />
</behavior>
</serviceBehaviors>
所有这些交易在完全相同的方式传入的SOAP请求(它只是扼杀他们基于优先级)的。每个优先级就像这样继承BaseService
类。
public class Priority1Service : BaseService { }
public class Priority2Service : BaseService { }
public class Priority3Service : BaseService { }
正如你所看到的,有在优先级没有实现,因为我只是用继承的行为。有一个更好的方法吗?有没有一种方法可以在soap消息中传递优先级,并让服务基于此处理它?我理想地希望能够摆脱只继承行为的这些类。
我认为这是问题的一部分,我已经定义了不同的服务。 – 2012-08-14 13:31:35
那么你为什么试图创建继承BaseService的类? – daryal 2012-08-14 13:48:57
由于功能保持不变,因此只有节流根据优先级而改变。 – 2012-08-14 14:37:10