简体   繁体   中英

connect ASP.NET web application to Windows Service application

I have one windows service application and one ASP.NET web application, both created by C#. Both applications get data from the database(SQL server).

Once I update database from web application, how could I inform service application to reload data from database?

Right now our solution is to use service controller to restart windows service application. Is there any low cost solution, like communication between service application and web application?

By the way, my boss hate polling method...

If wcf is a choice, can anyone post some materials?

Thanks a lot!

you can implement workflow services that runs as a windows service. That service must have an activy that can be called over net.tcp request and processes your request. I'm using this solution and works fine. Other way is the service use the database to check if it's necessary to perform the reload.

You can take advantage of Service Broker

In a nutshell: using the SqlDependency class you can wire up an event in C# that will fire whenever a table gets updated. At that point in time, you can re-load the new data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM