Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows Service with asp.net

Status
Not open for further replies.

asafblasberg

Programmer
Jun 22, 2004
21
US
Hi

I want to create a Windows Service which sends email every week to me. In the email is a copy of the data from one of my tables in a sql server database.

How difficult is this to do and does anybody know how to do it?
 
it's not doable with ASP.NET.

you would need to use C# and in Visual Studio create a new project using Windows Service template.

should be fairly easy

--------------------------
"two wrongs don't make a right, but three lefts do" - the unknown sage
 
Or VB.NET. ;-)

The concepts to remember when writing a service are:

1. No interaction with the desktop is allowed
2. Services start at boot time
3. No interaction with the desktop is allowed

Yes I said it twice -- it's the single area that most people have trouble with. This means you cannot use MsgBoxes to debug -- you have to write to a file or the NT event log if you want to follow your code execution. Or write a custom trace listener.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
I always just manually attach to the running process to debug (assuming you don't have to wait a week for the service timer to iterate or something).

It's definately possible to do what you want, and shouldn't be hard at all. As said, you just create the Windows Service via a template, then add a timer (not the Windows Forms timer, one of the other two), and, if the time is right, have your application send the e-mail via ADO.NET and SmtpMail (or whatever you'd like to use).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top