How to make HTTP request in windows service? [closed]

自古美人都是妖i 提交于 2019-12-09 06:54:14

问题


i want to implement my first windows service application. this app must run day and night. it should to send each 1 hour http request with possibility to make snapshot of requested webpage and save it in database.

can you show me some c# code examples how to:

  1. make http request from windows service.
  2. set a timer for requesting each 1 hour.
  3. send e-mail that snapshot is successfully saved in DB.

thank you!


回答1:


The following 3 MSDN pages should get you started.

  1. Make HTTP Request: http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx
  2. Working with timers: http://msdn.microsoft.com/en-us/library/system.timers.timer(v=VS.100).aspx
  3. Emailing: http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.aspx


来源:https://stackoverflow.com/questions/4826216/how-to-make-http-request-in-windows-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!