Where is the WCF service start method?

I need to run some methods before the first wcf service call, where can I put these methods? Where is the WCF service start method?

Obs1: my WCF service will run on IIS6. Obs2: I am using .net framework 4.0.

+8
c # wcf
source share
2 answers

One way to do this is to host your WCF services yourself (as in IIS). That way, you can run any code you want before untwisting services.

Another way is to add a static method call to the constructor of each implementation of the service behavior. This call to the static method will perform a check to verify that the initialization is complete. Just make sure you are working with multi-threaded concurrency during this call.

+4
source share

Depending on the life cycle configuration of your service, WCF will either create a service class for each call (singlecall), for each client (session), or only once for each call to each client (singleton).

You can implement the IInstanceProvide r interface and take control of the creation process. This way you can get the ability to call methods in the class before actually calling wcf.

+3
source share

All Articles