How can I broadcast SQL Event/Query Notification inside a WCF Service Application project hosted in IIS?

93 views Asked by At

I need to implement a WCF Service Application project hosted in IIS, that can detect Database changes and broadcast to a WCF client (Windows Forms application). Inside WCF Service Application I see only an example of a WCF service. After searching on the internet I have found that this WCF Service Application does not contains some entry point (e.g. static Main method), so how can I register some listeners to "listen" database query/event changes?

1

There are 1 answers

0
Athanasios Kataras On

Usefull guide here on running startup code:

http://smax-it.net/Global-Startup-Code-WCF-IIS/

Add a Global.asax file in VS, then use Application_Start method in the code-behind class (inhereted from HttpApplication)

Create an App_Code folder, then create a class (with any name) with a public static void AppInitialize(). This approach can be a bit tricky, because the class will be compiled during startup and you cannot use any internal classes, e.g. Settings.

Starting from the .NET Framework 4.5 you can define a public static void Configure(ServiceConfiguration config) for a service class. It will override any existing app.config/web.config configuration. Details: MSDN Article

Implement ServiceHostFactory