![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Multithreading in WCF Service Hi! Can anybody tell me how to turn on multithreading in a Singleton WCF service? Currently only one operation executes after the other and all the other clients have to wait until the currently executing operation has completed. Any help would be greatly appreciated! Thanks a lot in advance! Markus |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: Multithreading in WCF Service On Jun 14, 6:51 am, "Markus Strobl" <m.str...@nospam.nospam> wrote: > Hi! > > Can anybody tell me how to turn on multithreading in a Singleton WCF > service? > > Currently only one operation executes after the other and all the other > clients have to wait until the currently executing operation has completed. > > Any help would be greatly appreciated! > > Thanks a lot in advance! > > Markus I haven't actually played around with this myself, but I believe this is controlled by the ServiceBehavior ConcurrencyMode. By default it is Single and now allowing re-entrancy. You may try Multiple e.g. [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)] public class MyService : IMyService { But, you are saying that it is not re-entrant from other clients. I was under the impression that if from different clients that the Service was by default able to handle multiple clients and not block. The Multiple mode is used then to allow re-entrancy from the same client in this case. A WCF service by default would allow re- entrancy from multiple clients up to the MaxConnections property of the binding configuration, or I believe may also be controlled by IIS configuration. Did you specify a different InstanceContextMode, or using the default? e.g. [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)] public class MyService : IMyService I think the default is PerSession and allows the re-entrancy by multiple clients. But, if was changed to InstanceContextMode.Single then you would see the issue with one client blocking the other since they are sharing the same service instance. Ron |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Multithreading in WCF Service Hi Ron, thanks a lot for your reply!! Applying the Attribute [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)] made it work! I had to keep InstanceContextMode at InstanceContextMode.Single as i'm exposing a Singleton object and InstanceContextMode.Single is required for this pattern. Thanks again and Best wishes Markus <ronscottlangham@yahoo.com> schrieb im Newsbeitrag news:1181823085.263375.229910@a26g2000pre.googlegroups.com... > On Jun 14, 6:51 am, "Markus Strobl" <m.str...@nospam.nospam> wrote: >> Hi! >> >> Can anybody tell me how to turn on multithreading in a Singleton WCF >> service? >> >> Currently only one operation executes after the other and all the other >> clients have to wait until the currently executing operation has >> completed. >> >> Any help would be greatly appreciated! >> >> Thanks a lot in advance! >> >> Markus > > I haven't actually played around with this myself, but I believe this > is controlled by the ServiceBehavior ConcurrencyMode. By default it > is Single and now allowing re-entrancy. You may try Multiple e.g. > > [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)] > public class MyService : IMyService > { > > But, you are saying that it is not re-entrant from other clients. I > was under the impression that if from different clients that the > Service was by default able to handle multiple clients and not > block. The Multiple mode is used then to allow re-entrancy from the > same client in this case. A WCF service by default would allow re- > entrancy from multiple clients up to the MaxConnections property of > the binding configuration, or I believe may also be controlled by IIS > configuration. > > Did you specify a different InstanceContextMode, or using the > default? e.g. > > [ServiceBehavior(InstanceContextMode = > InstanceContextMode.PerSession)] > public class MyService : IMyService > > I think the default is PerSession and allows the re-entrancy by > multiple clients. But, if was changed to InstanceContextMode.Single > then you would see the issue with one client blocking the other since > they are sharing the same service instance. > > Ron > |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: Multithreading in WCF Service Wow, I overlooked this. I had assumed that a WCF singleton was always blocking, single-threaded. ... but at http://msdn.microsoft.com/msdnmag/is...s/default.aspx .. "Having a singleton implies the singleton has some valuable state that you want to share across multiple clients. The problem is that when multiple clients connect to the singleton, they may all do so concurrently on multiple worker threads." Rawk! Problem? All your service variables are static. Fine, I was using static variables anyway. Jon "Markus Strobl" <m.strobl@nospam.nospam> wrote in message news:uHQWLborHHA.4764@TK2MSFTNGP06.phx.gbl... > Hi Ron, > > thanks a lot for your reply!! > > Applying the Attribute [ServiceBehavior(ConcurrencyMode = > ConcurrencyMode.Multiple)] made it work! > > I had to keep InstanceContextMode at InstanceContextMode.Single as i'm > exposing a Singleton object and InstanceContextMode.Single is required for > this pattern. > > Thanks again and Best wishes > > Markus > > > > <ronscottlangham@yahoo.com> schrieb im Newsbeitrag > news:1181823085.263375.229910@a26g2000pre.googlegroups.com... >> On Jun 14, 6:51 am, "Markus Strobl" <m.str...@nospam.nospam> wrote: >>> Hi! >>> >>> Can anybody tell me how to turn on multithreading in a Singleton WCF >>> service? >>> >>> Currently only one operation executes after the other and all the other >>> clients have to wait until the currently executing operation has >>> completed. >>> >>> Any help would be greatly appreciated! >>> >>> Thanks a lot in advance! >>> >>> Markus >> >> I haven't actually played around with this myself, but I believe this >> is controlled by the ServiceBehavior ConcurrencyMode. By default it >> is Single and now allowing re-entrancy. You may try Multiple e.g. >> >> [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)] >> public class MyService : IMyService >> { >> >> But, you are saying that it is not re-entrant from other clients. I >> was under the impression that if from different clients that the >> Service was by default able to handle multiple clients and not >> block. The Multiple mode is used then to allow re-entrancy from the >> same client in this case. A WCF service by default would allow re- >> entrancy from multiple clients up to the MaxConnections property of >> the binding configuration, or I believe may also be controlled by IIS >> configuration. >> >> Did you specify a different InstanceContextMode, or using the >> default? e.g. >> >> [ServiceBehavior(InstanceContextMode = >> InstanceContextMode.PerSession)] >> public class MyService : IMyService >> >> I think the default is PerSession and allows the re-entrancy by >> multiple clients. But, if was changed to InstanceContextMode.Single >> then you would see the issue with one client blocking the other since >> they are sharing the same service instance. >> >> Ron >> > > |
My System Specs![]() |
| | #5 (permalink) |
| Guest | Re: Multithreading in WCF Service On Jun 14, 2:14 pm, "Jon Davis" <j...@REMOVE.ME.PLEASE.jondavis.net> wrote: > Wow, I overlooked this. I had assumed that a WCF singleton was always > blocking, single-threaded. > > .. but athttp://msdn.microsoft.com/msdnmag/issues/06/06/wcfessentials/default...... > > "Having a singleton implies the singleton has some valuable state that you > want to share across multiple clients. The problem is that when multiple > clients connect to the singleton, they may all do so concurrently on > multiple worker threads." > > Rawk! Problem? All your service variables are static. Fine, I was using > static variables anyway. > > Jon > > "Markus Strobl" <m.str...@nospam.nospam> wrote in message > > news:uHQWLborHHA.4764@TK2MSFTNGP06.phx.gbl... > > > Hi Ron, > > > thanks a lot for your reply!! > > > Applying the Attribute [ServiceBehavior(ConcurrencyMode = > > ConcurrencyMode.Multiple)] made it work! > > > I had to keep InstanceContextMode at InstanceContextMode.Single as i'm > > exposing a Singleton object and InstanceContextMode.Single is required for > > this pattern. > > > Thanks again and Best wishes > > > Markus > > > <ronscottlang...@yahoo.com> schrieb im Newsbeitrag > >news:1181823085.263375.229910@a26g2000pre.googlegroups.com... > >> On Jun 14, 6:51 am, "Markus Strobl" <m.str...@nospam.nospam> wrote: > >>> Hi! > > >>> Can anybody tell me how to turn on multithreading in a Singleton WCF > >>> service? > > >>> Currently only one operation executes after the other and all the other > >>> clients have to wait until the currently executing operation has > >>> completed. > > >>> Any help would be greatly appreciated! > > >>> Thanks a lot in advance! > > >>> Markus > > >> I haven't actually played around with this myself, but I believe this > >> is controlled by the ServiceBehavior ConcurrencyMode. By default it > >> is Single and now allowing re-entrancy. You may try Multiple e.g. > > >> [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)] > >> public class MyService : IMyService > >> { > > >> But, you are saying that it is not re-entrant from other clients. I > >> was under the impression that if from different clients that the > >> Service was by default able to handle multiple clients and not > >> block. The Multiple mode is used then to allow re-entrancy from the > >> same client in this case. A WCF service by default would allow re- > >> entrancy from multiple clients up to the MaxConnections property of > >> the binding configuration, or I believe may also be controlled by IIS > >> configuration. > > >> Did you specify a different InstanceContextMode, or using the > >> default? e.g. > > >> [ServiceBehavior(InstanceContextMode = > >> InstanceContextMode.PerSession)] > >> public class MyService : IMyService > > >> I think the default is PerSession and allows the re-entrancy by > >> multiple clients. But, if was changed to InstanceContextMode.Single > >> then you would see the issue with one client blocking the other since > >> they are sharing the same service instance. > > >> Ron Probably known, but I will mention anyway. You need to make sure that you server code is thread-safe and you have locks and other multithreading protection around your variables, objects, etc. |
My System Specs![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to install service to bypass Vista Interactive Services Detection Service | kianlie84 | Vista security | 0 | 08-28-2008 02:25 AM |
| Vista Multithreading, lack thereof ??? | David Jones | Vista performance & maintenance | 2 | 06-01-2007 10:51 AM |
| Multithreading | gaurhoth | PowerShell | 4 | 11-26-2006 01:42 PM |
| multithreading? | JamesPang | PowerShell | 1 | 11-20-2006 07:58 AM |