Global.asax Application_Start()在开发环境中工作,但不在服务器上 [英] Global.asax Application_Start() working in dev environment but not on server

查看:60
本文介绍了Global.asax Application_Start()在开发环境中工作,但不在服务器上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我到处都有搜索,但是没有什么适合我的问题.

我正在尝试初始化Application_Start()中的某些对象. Application_Start()从未在我的服务器上调用,而是在我的桌面上.

我认为问题在于,当我使用Web Deploy将站点加载到服务器时,Global.asax和Global.asax.cs最终会出现在根目录和bin目录中,而它们只应该位于我的根目录中. web.config.

I have search everywhere but nothing applies to my problem.

I am TRYING to initialize some objects in Application_Start(). Application_Start() is never called on my server but is on my desktop.

I think the problem lies in the fact that when I load the site to the server, using Web Deploy, the Global.asax and Global.asax.cs end up in BOTH the root and bin directories when they should only be in my root with web.config.

Adding child filePath (Default Web Site\bin\Global.asax).
Adding child filePath (Default Web Site\bin\Global.asax.cs).
...
Adding child filePath (Default Web Site\Global.asax).



谁能给我解释为什么会这样吗? asax文件应该驻留在根目录中正确吗?这就是为什么未调用Application_Start()的原因吗?

另外...如果我查看项目中的bin文件夹,则其中不包含asax文件.

我刚刚注意到的另一件事...将站点加载到服务器后,项目中的本地bin文件夹似乎同时具有这两个文件.

谢谢.



Can anyone give me an explanation as to why this is happening? The asax files should reside in the root directory correct? Is this the reason why Application_Start() is not being called?

Also...If I look in the bin folder in my project, it does NOT contain the asax files.

One other thing I just noticed...after I load the site to the server, the local bin folder in my project seems to have both files.

Thanks.

推荐答案

如果更改了web.config文件并保存了更改,它将强制重新启动应用程序.
之后,检查是否触发了Application_Start()事件
If you change the web.config file and save changes it will force the application to be re-started.
After that check if the Application_Start() event is fired


这篇关于Global.asax Application_Start()在开发环境中工作,但不在服务器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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