WCF ConcurrencyMode Single and InstanceContextMode PerCall

后端 未结 2 1717
情话喂你
情话喂你 2020-12-05 14:25

I have an issue with my wcf service config. I would like every call to my service create a new instance of the service. For the concurrency I would like to one call is fini

2条回答
  •  孤街浪徒
    2020-12-05 15:07

    What you have there will result in a new instance of the service spinning up with each request (that's what PerCall does).

    This should do it:

    [ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Single, InstanceContextMode=InstanceContextMode.Single)]
    

    FYI if you do this you'll lose all scalability. You'll have a single instance of a single threaded service to respond to all requests.

提交回复
热议问题