Hi There,
I have a WCF service written. I want it to pick up some "global settings" upon startup. The WCF service will run under IIS.
Here's how I am doing it, but I want to make sure this is the correct way. Can an expert comment?
I put the relevant data in web.config. Now I don't believe I can access this in my WCF class as such, so...
I've created a Global.asax file, and in its
Application_Start
method, I read in the relevant data into an object, which I place into theAppDomain
usingAppDomain.CurrentDomain.SetData("MySettings", settingsObj);
Then in my WCF Service Implementation class I have a static constructor. This reads the relevant global object from the
AppDomain
usingAppDomain.CurrentDomain.GetData("MySettings");
This all seems to work, but I'm wondering if this is the correct way? I understand why the WCF service implementation has no access to the HttpContext
.
Thanks, Dermot.