Lib*_* TK 1 c# asp.net iis azure
我使用以下代码来清理我的Azure应用程序的数据库.
protected void Application_End(object sender, EventArgs e)
{
core.cleanUpDB();
}
Run Code Online (Sandbox Code Playgroud)
我可以在调试时阻止在本地计算机上执行此操作吗?我只想在部署的Azure应用程序上执行此操作.
提前致谢.
您可以使用HttpRequest.IsLocal来区分本地和服务器请求.
protected void Application_End(object sender, EventArgs e)
{
if(!System.Web.HttpContext.Current.Request.IsLocal)
core.cleanUpDB();
}
Run Code Online (Sandbox Code Playgroud)