Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/275.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
C# WCF服务中的优先级划分_C#_Wcf_Web Services - Fatal编程技术网

C# WCF服务中的优先级划分

C# WCF服务中的优先级划分,c#,wcf,web-services,C#,Wcf,Web Services,目前,我在单个服务中有几个端点,它们调用相同的操作,但根据优先级有不同的限制配置 <serviceBehaviors> <behavior name="PriorityService1"> <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" /> <serviceDebug includeExceptionDetailInFaults="true

目前,我在单个服务中有几个端点,它们调用相同的操作,但根据优先级有不同的限制配置

  <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消息中传递优先级,并让服务基于此处理优先级?理想情况下,我希望能够摆脱这些只继承行为的类。

尝试在web.config文件中定义不同的服务配置

<services>
      <service behaviorConfiguration="PriorityService1" name="Sample.Sample">
        ...
      </service>
      <service behaviorConfiguration="PriorityService2" name="Sample.Sample">
        ...
      </service>
      <service behaviorConfiguration="PriorityService3" name="Sample.Sample">
        ...
      </service>
</services>

...
...
...

尝试在web.config文件中定义不同的服务配置

<services>
      <service behaviorConfiguration="PriorityService1" name="Sample.Sample">
        ...
      </service>
      <service behaviorConfiguration="PriorityService2" name="Sample.Sample">
        ...
      </service>
      <service behaviorConfiguration="PriorityService3" name="Sample.Sample">
        ...
      </service>
</services>

...
...
...

我认为这是问题的一部分,我已经定义了不同的服务。那么为什么要尝试创建继承BaseService的类呢?因为功能保持不变,只有限制更改取决于优先级。AFAIK限制是从web.config文件配置的。那么为什么要创建不同的类呢?我想这是问题的一部分,我已经定义了不同的服务。那么为什么要尝试创建继承BaseService的类呢?因为功能保持不变,只有依赖于优先级的限制更改。AFAIK限制是从web.config文件配置的。那么为什么要创建不同的类呢?