.net - Web Service in a Windows Service: Multithreading -
summary: how parallel requests web service managed when host windows service?
i know soap web service can hosted within iis, console application or winforms application. 1 reason or another, these hosts not available me , must host web service within windows service.
in case of iis, have read web server manages multiple parallel requests , assigns them different threads. need understand how multithreading works in case of windows service. component responsible it? pool-based or something? how , can configrue pool-size etc?
the term 'web service' broad. please review web service vs wcf service clarification. in case question wcf-based services, there article on concurrency here: http://www.codeproject.com/articles/89858/wcf-concurrency-single-multiple-and-reentrant-and.
to answer questions:
the system.servicemodel.servicehost
responsible hosting service. servicebehavior attribute in app config or in code can used set desired behavior, so:
[servicebehavior(concurrencymode=concurrencymode.multiple)] var yourservicehost = new servicehost(yourservice);
the threads created thread pool. can control number of threads being used system.servicemodel.description.servicethrottlingbehavior
or in app config:
<servicebehaviors> <behavior name="servicebehavior"> <servicethrottling maxconcurrentinstances="<your_max_instances>" maxconcurrentsessions="<your_max_concurrent_sessions>" /> </behavior> </servicebehaviors>
Comments
Post a Comment