Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the starting point for a WCF Library app?

Tags:

wcf

Where is the best place to put code for when a WCF service is just started up? Similar to Page_Load in a web application.

like image 931
Xaisoft Avatar asked Jun 16 '11 19:06

Xaisoft


2 Answers

The service implementation constructor would be the obvious place but it also depends on your hosting model

1) run once code: IIS hosting = global.asax; self-hosting = Main / OnStart

2) run once per service instance: constructor of service class

3) Something more exotic: implement IInstanceProvider

like image 91
Richard Blewett Avatar answered Nov 15 '22 09:11

Richard Blewett


In the class constructor of the service implementation.

like image 38
Frode Stenstrøm Avatar answered Nov 15 '22 11:11

Frode Stenstrøm