I have created a windows service and I would like it to access a web cache. I have stored a datatable in web cache and I would like for my windows service to access and process it. Is this possible?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Not directly. Your Windows Service is running as a separate process from the application pool your web application is running as. You’ll need to use some form in inter-process communication. You may also want to consider the possibility that you’ll eventually want or need to deploy the Windows Service on a different server than your web application.
You can expose a web service from your web application that your service calls to access/update the cached data as jro suggested. Or, you could use SQL Server to store the data and SQL Notification Services to alert the Windows Service that the data had changed. That would prevent you from having to continuously poll a web service from your Windows Service. Another option would be to expose a WCF endpoint from your Windows Service that you could invoke from your web application to pass the data.
Choosing a pattern really depends on your requirements – particularly which end of the communication will be initiating updates.