我使用 Visual Studio 2008 发布我的 asp.net 网站。当我在服务器(Windows 2008 服务器)上打开网站时,我注意到 global.asax 中的代码没有运行。我的 Global.asax 正文类似于:
<%@ Application Language="C#" %>
<script runat="server">
protected void Application_Start()
{
// Initialize some site settings like a task scheduler
}
protected void Application_End(object sender, EventArgs e)
{
// Perform some clean up code
}
</script>
编译的网站 bin 文件夹中有一个 App_global.asax.dll,但这似乎没有帮助。
是否有我缺少的配置选项?删除 App_global.asax.dll 并将原始 global.asax 与预编译网站一起使用可以正常工作。