Pergunta

I have some Service class which is defined as InstanceContextMode.Single, and is well known in the hosting application. (The host creates an instance, and passes that to the WebServiceHost)

Hosting app:

WebServiceHost host = null;
SomeService serviceInstance = new SomeService("text", "more text");
host = new WebServiceHost(serviceInstance, baseUri);
Problem:
When I go to use the variables initialised when the service is created (ie, when a call is made to the service), they are either null or empty...

Am I wrong in assuming that as the instance being initialised in the hosting application is used for each request to the WebServiceHost?

Any pointers here would be great.

Foi útil?

Solução

Your assumption seems correct to me. Did you put the right code in the service constructor?

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top