Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There's no benefit or choice, really - one <code>ServiceHost</code> (instance of that class) can host exactly one service, and for each service, you need a separate service host. It's a 1:1 mapping - always, no choice.</p> <p>But of course, your Windows NT service or console app can have multiple <code>ServiceHost</code> objects active at the same time. This can be useful if you have a set of services that logically belong together and can't really exist without one another - where it doesn't make sense to have one of them started and another one not started.</p> <p>And yes, a service host can host a service which exposes multiple endpoints, and multiple clients can connect on those separate endpoints at the same time, no problem. The WCF runtime will spin up a number of worker threads to handle incoming requests (you can limit those with the ServiceThrottling behavior) independently of each other.</p> <hr> <p>To set up and control, how many concurrent calls and requests you have, you'll need to look at the ServiceThrottling behavior on the server side.</p> <pre><code>&lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="serviceThrottled"&gt; &lt;serviceThrottling maxConcurrentCalls="16" maxConcurrentInstances="26" maxConcurrentSessions="10"/&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; </code></pre> <p>and you need to reference that service behavior configuration in your service declaration, of course:</p> <pre><code>&lt;service name="YourService" behaviorConfiguration="serviceThrottled"&gt; ..... &lt;/service&gt; </code></pre> <p>These are the default values. The explanations are as follows (taken from Dan Rigsby's blog post, shortened):</p> <ul> <li><p><strong>MaxConcurrentCalls</strong> (default = 16) [Per-message] The maximum number of messages that can actively be processed. </p></li> <li><p><strong>MaxConcurrentInstances</strong> (default = 26) The maximum number of InstanceContext objects in a service that can execute at one time. For per-session service, this is equal to the maximum number of sessions, for per-call service, it's the maximum number of concurrent calls, and for singletons, it's pointless.</p></li> <li><p><strong>MaxConcurrentSessions</strong> (default = 10) [Per-channel] The maximum number of sessions that a service can accept at one time. Only comes into play with session-based bindings (wsHttp or netTcp) </p></li> </ul> <p>Definitely also check out <a href="http://www.danrigsby.com/blog/index.php/2008/02/20/how-to-throttle-a-wcf-service-help-prevent-dos-attacks-and-maintain-wcf-scalability/" rel="noreferrer">Dan Rigsby's excellent blog post</a> on the topic.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload