Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,,I had developed a windows service and now i want to add a method so that it sends a mail or message with respective to the database call....can any one help this???
Posted

1 solution

Hi,

Right click in your Web application
then Add New Item
then Select Web Service
Type the name of your web service

The default is WebService1.asmx
The visual studio will automatically create a
Web service code template for you.

You may add as many WebMethod in your created Webservice.


Hope this could help.

Do not forget to vote if could help. The highest vote is 5.

Regards,
 
Share this answer
 
Comments
Maruthiram_99 12-Feb-13 1:22am    
protected override void OnStart(string[] args)
{
string strBody = "Hello";
string strSubject = "test";
//conn.Close();

//string subjectTo = "this is a sample message to check!!!!!";
SendEmail(strSubject, strBody, "****.com", "*****.com", "****8.com", "");

eventLog1.WriteEntry("In OnStart");
FileStream fs = new FileStream(@"c:\temp\mcWindowsService.txt",
FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter m_streamWriter = new StreamWriter(fs);
m_streamWriter.BaseStream.Seek(0, SeekOrigin.End);
m_streamWriter.WriteLine(" mcWindowsService: Service Started \n" + DateTime.Now);
m_streamWriter.Flush();
m_streamWriter.Close();
}
This is my OnStart function of my window service...In this i have written a mail function but i am not getting required output...can u help me plzzzz

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900