Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute some initial startup code on a IIS hosted WCF app?

Tags:

c#

asp.net

iis

wcf

I'm trying to find a hook / way to run some initial code to wire up a bunch of things before a service is called.

any ideas?

like image 516
Keith Nicholas Avatar asked Jul 10 '26 05:07

Keith Nicholas


2 Answers

Well, a simple way would be a static constructor on your service class? Presumably global.asax works too. Yet another route would be to write and register an http-module that listens to startup.

like image 183
Marc Gravell Avatar answered Jul 11 '26 18:07

Marc Gravell


You could to implement an IServiceBehavior.

like image 36
Rubens Farias Avatar answered Jul 11 '26 19:07

Rubens Farias