编写服务以定期检索XML并发送SMS [英] writing a service to periodically retrieve XML and send SMS

查看:69
本文介绍了编写服务以定期检索XML并发送SMS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个.Net专家,我对启动这个项目很感兴趣,但是我不确定最好的方法是什么.

I'm a .Net guy, and I'm interested in starting this project but I'm not sure what the best approach is.

我想做相当于编写Windows服务的操作,该服务会定期访问网站以获取XML(例如Google天气),然后在满足某些条件(即今晚将冻结)时发送SMS消息,昨晚不冻结(所以我知道要盖住水龙头,等等).

I want to do the equivalent of writing a windows service, that periodically hits a site to get XML, (say google weather) and then sends SMS messages if certain criteria are met (ie it's going to freeze tonight, and it did not freeze last night(so I know to cover up my faucets, etc)).

所以我的问题是两方面的,是否已经有托管的应用程序了?

So my question is two fold, is there some hosted app out there that does this already?

如果不是最好的方法是什么?我可以在c#中将其鞭打并在本地机器上运行,但随后必须始终打开并连接.

If not what's the best approach? I could just whip it up in c# and run it on my local box, but then it'd have to alway be on and connected.

有托管服务可让您运行.Net服务而不是Web服务器吗?

Are there Hosting services that let you run a .Net service instead of a web server?

我是否缺少一些明显更好的方法来做到这一点?

Is there some obvious better way to do this that I'm missing?

我觉得应该有一个非常简单的解决方案,而我正盯着它...

I feel like there should be a really simple solution and I'm staring right at it...

推荐答案

它不一定必须是服务.您可能拥有一个Asp.Net网站,该网站在后台运行一个单独的线程来执行您要执行的操作.您可以在应用程序启动事件中设置线程,然后再不终止线程.需要说明的是IIS如何回收应用程序池-在请求网页之前,它可能不会重新启动该池.

It doesn't necessarily have to be a service. You could have an Asp.Net website that runs a separate thread in the background that does what you're looking to do. You could set up the thread in the application start event and then never terminate the thread. The caveat here is how IIS recycles the app pool - it might not restart the pool until a web page is requested.

这篇关于编写服务以定期检索XML并发送SMS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆