I need something that will run on our internal network and monitor a SQL Server database for a condition based on a date field and then generate an email when that condition is met to an internal user.
Attempt to restate; It should monitor the DB and when the Date in a certain field reaches a variable it should generate and send an Email to the related User.
i.e. an Auto-Reminder
I send emails through our Exchange Server in our Desktop app already so I believe I am good on the Email portion. I have not done much web developing though so I am wondering if a Web Service is what I am looking for in answer to my question.
I once wrote a Windows Service that monitors a network location and generates an email based on events there, is this similar? How do you interact with a SQL Server database from a windows service? What about WCF, where does that fit in.
I just want to make sure 开发者_如何转开发I am looking in the right direction.
I did the same and a Windows Service is far better that a web service in your specific case.
You cannot automatically monitor something using a Web service; you must have another process (usually a Windows Service) that will query the webservice to trigger it's execution.
by the way, since you are monitoring a Database, you could also send email from a SQL server trigger, but since you are doing in on a condition based on a date field, it's not really a good approach.
If you are going to monitor one or more tables in a MS SQL Database, i think using triggers or sql jobs are the way you should go. (I personally have no experience with triggers, but I think they are like events for tables).
But in another solution:
You can develop a windows service. Put a timer in your windows service (let's say it elapses every 1 minute) and check what ever you need when timer is elapsed and than wait for the next event.
In this case you can check so many other conditions like: Pinging an IP, Run a query on a DB, check a file, etc...
Web Services are different things and they are not what you need right now. A web services is like a gateway or api for an application. When you use facebook's API, in fact you are connecting to a web service.
UPDATE:
About WCF: Let's say WCF is more cooler way of implementing a web service. It gives your more power, not only when developing a web services. You may want your application to communicate with other apps by a TCP Channel. Also it's kind of a successor to .Net remoting.
WCF on MSDN: http://msdn.microsoft.com/en-us/netframework/aa663324.aspx
精彩评论