writing a service to periodically retrieve XML and send SMS

﹥>﹥吖頭↗ 提交于 2019-12-24 22:50:35

问题


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

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?

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.

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...


回答1:


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.



来源:https://stackoverflow.com/questions/4742154/writing-a-service-to-periodically-retrieve-xml-and-send-sms

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