In my managed application, my WCF services currently work as:
SomeService service = new SomeService(container) //IUnityContainer ServiceHost serviceHost = new ServiceHost(service, serviceAddress);
What is the catch? SomeService is defined using
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single
This is no longer good, I need to make it InstanceContextMode.PerCall .
When trying .Open () When changing the InstanceContextMode to "PerCall" - it will throw:
System.InvalidOperationException: In order to use one of the ServiceHost constructors that takes a service instance, the InstanceContextMode of the service must be set to InstanceContextMode.Single. This can be configured via the ServiceBehaviorAttribute. Otherwise, please consider using the ServiceHost constructors that take a Type argument
Is this a solution to my problem? How to pass values ββto a constructor in my wcf service?
My main problem:
I am running different types of services inside this managed application. This solution seems to be good only if I run one type of service.
source share