Web服务在4小时后停止.为什么? [英] Web service get stop after 4 hours.Why?

查看:76
本文介绍了Web服务在4小时后停止.为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用asp.net c#Web应用程序.我想创建一个应用程序,在该应用程序中,我必须每1小时自动向用户发送一次邮件.
我为此使用了Web服务...我将应用程序上传到Web服务器上,并且在运行该页面时一次启动Web服务并且每隔一小时就会发送一次邮件.

但是我的问题是,此Web服务在四个小时后停止.再次要启动Web服务,我们必须运行该页面.然后在四个小时后再次停止.

我需要Web服务永远不会停止,并且我的邮件发送功能一直在工作.

请帮忙...很紧急...

谢谢



I am working asp.net c# web application.I want to create a application in which i have to send automatically mail in every 1 hour to user.
I used web service for that...I uploaded my application on web server,and when run the page one time web service start and in every one hour mail is sent.

But my problem is that, this web service is stopped after four hours.And again for start web service we have to run the page.And it again stop after 4 hours.

I need that web service will never stop,and my mailing functionality is working all the time.

Please help...Its urgent...

Thanks

推荐答案

这不是Web应用程序应该做的事情. Web应用程序是从页面请求中调用的,预计将很快消失-尽管ASP.net在整个浏览会话中都保留了应用程序实例"的概念,但它在设计之后并不能持久存在.用户已离开.而是编写一个守护程序(对于Windows服务器,服务)以发送邮件,或安排重复作业.

实际上,我们在最近的项目中做了非常相似的事情,我们所做的是创建一个Windows服务,该服务检查数据库表中向谁发送邮件(每隔10分钟左右,如果我记得正确的话).当发现用户需要电子邮件时,该Web应用程序(主要是Silverlight应用程序的后端)将记录发布到该表.

通常,Web服务是您要从其他地方调用的服务,我看不出仅在本地调用该服务的原因.但是您应该能够无限期地托管Web服务.查看事件日志中的评论,可能是您做错了,应该给您一个提示.
This isn''t something that should be done with a web app. Web applications are called from a page request, and are expected to go away reasonably quickly – and while ASP.net keeps the idea of an ''application instance'' around for an entire browsing session, it''s not designed to persist after the user has gone away. Instead, write a daemon (for a Windows server, a service) to send the mails, or schedule a repeating job.

We actually did something quite similar in a recent project and what we did was create a Windows service that checked a database table for who to send mail to (every 10 minutes or so if I remember right). The web app (back end to a Silverlight app, mostly) posted records to that table when it found that a user needed an email.

A web service is generally if you want to call the service from elsewhere, I don''t see the reason to use one when it is just to be called locally. But you should be able to host a web service indefinitely. Check the event logs as the comments mention, you are probably doing something wrong and that should give you a clue.


这篇关于Web服务在4小时后停止.为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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