Can I get a link to an instance of the SingleHost ServiceHost WCF before the first WCF client request appears?

I am trying to access a singleton instance created by my WCF service, but .SingletonInstanceit seems to be null even after being .Opencalled in ServiceHost.

Is there a way to force ServiceHostan instance to be created before the first client of the WCF request (which supposedly automatically spawns a singleton instance)?

+3
source share
4 answers

You can make a service call ... An
instance is really only created when a request arrives, you cannot access what does not exist yet.

, . , ?

+2

, , , . ServiceHost, , : http://msdn.microsoft.com/en-us/library/ms585487.aspx#Y342

, , ServiceHost. , , . . .

+8

.... IInstanceContextProvider... , , ....

0

You can use the constructor of your class and save an instance of the object when it is created using wcf servicehost

0
source

Source: https://habr.com/ru/post/1736200/


All Articles