Currently I have several endpoints within a single service which invoke the same action but have different throttling configurations based on their priority.
<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>
Each of these deals with the incoming SOAP request in exactly the same way (it just throttles them based on priority). Each of the priorities just inherits from a BaseService class like so.
public class Priority1Service : BaseService { }
public class Priority2Service : BaseService { }
public class Priority3Service : BaseService { }
As you can see, there is no implementation in the Priority classes because I just use the inherited behavior. Is there a better way to do this? Is there a way I can pass the prioritization in the soap message and have the service deal with it based off that? I’d ideally like to be able to get rid of these classes which only inherit behaviour.
Try defining different service configurations at the web.config file;