关闭ASP .NET应用程序中的问题 [英] Shut down issue in ASP .NET application

查看:63
本文介绍了关闭ASP .NET应用程序中的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨团队,



我正在研究aso .Net网络应用程序。我必须在以下情况下发送电子邮件通知。

1)每当我的应用程序崩溃时。

2)我正在使用第三方服务所以每当第三方服务失败时/崩溃然后我必须发送邮件。

3)每当数据库关闭时。



在上述情况下,我必须发送电子邮件通知。



注意:我已在Applivation_End事件中实现此代码,但此事件未被触发。



请帮我解决这个问题。



谢谢,

Jayaram



我尝试了什么:



我实现了这个Applivation_End事件中的代码,但此事件未被触发。

Hi team,

I am working on aso .Net web application. I have to send email notification in the fallowing scenarios.
1)whenever my application will get crashes.
2)I am using 3rd party services So whenever 3rd party service down/crash then I have to send mail.
3)whenever Database down.

In above scenarios I have to send email notification.

Note: I have implement this code in Applivation_End event but this event not getting fired.

Please help me how to resolve this problem.

Thanks,
Jayaram

What I have tried:

I have implement this code in Applivation_End event but this event not fired.

推荐答案

重新启动IIS池时,Application_End事件才会被触发(或其他一些不太相关的情况) ,而不是由于数据库不可用或其他原因导致网页崩溃。在一个Web应用程序中,当任何用户连接并使用它时,该应用程序正在运行,并且它不会因单个用户的问题而关闭。



您最好的方法用尝试...抓住块并使用它们来发送你的电子邮件。唯一的另一种方法是拥有一个单独的应用程序,可以频繁地轮询数据库和服务 - 这是一个坏主意,除非这是一个安全关键系统(即便如此,你可能希望在设计方面处理的事情比你的问题暗示你有!)
The Application_End event only ever gets fired when the IIS pool is restarted (or a couple of other less relevant cases), not when your web page crashes due to unavailable DB or whatever. In a web app, the app is running while any user is connected and using it, and it doesn't get shutdown for a single user's problem.

Your best approach is to pepper your website with try...catch blocks and use those to send your emails. The only other approach is to have a separate app that polls the DB and service at frequent intervals - and that's a bad idea unless this is a safety critical system (and even then, you probably want to handle things rather better in terms of design than your question implies you have!)


这篇关于关闭ASP .NET应用程序中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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