如何在 Windows 服务中发出 HTTP 请求?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4826216/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to make HTTP request in windows service?
提问by r.r
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.
我想实现我的第一个 Windows 服务应用程序。这个应用程序必须日夜运行。它应该每 1 小时发送一次 http 请求,并可以制作所请求网页的快照并将其保存在数据库中。
can you show me some c# code examples how to:
你能告诉我一些 C# 代码示例如何:
- make http request from windows service.
- set a timer for requesting each 1 hour.
- send e-mail that snapshot is successfully saved in DB.
- 从 Windows 服务发出 http 请求。
- 设置一个计时器,每 1 小时请求一次。
- 发送电子邮件,快照已成功保存在数据库中。
thank you!
谢谢你!
回答by Jordan
The following 3 MSDN pages should get you started.
以下 3 个 MSDN 页面应该可以帮助您入门。