[英]WindowsMediaPlayer on Global.asax application_start
[英]Application_Start() is not getting fired in Global.asax
這在本地以及我們的質量檢查服務器中都可以正常工作。 但是,在我們的一台客戶端服務器中,看來Application_Start()根本沒有被觸發。
我的Application_Start()看起來像這樣:
void Application_Start(object sender, EventArgs e)
{
EventLogging.LogEvent("Application_Start() fired in Global.asax.", EventLogging.LogLevel.Basic);
Application["ApplicationName"] = "My Application Name";
EventLogging.LogVerbose("Application_Start() - ApplicationName: " + (Application["ApplicationName"] ?? "NA"));
}
在我的一個代碼模塊中,我檢查Application [“ ApplicationName”],如果它具有值,則啟動一個長時間運行的調度程序線程。 問題是Application_Start()從未設置過此Application [“ ApplicationName”]。
到目前為止我嘗試過的是:
PrecompiledApp.config
在我的網站的根目錄中 App_global.asax.dll
, App_global.asax.compiled
和App_global.asax.pdb
。 我的網站的IIS應用程序池具有以下屬性:
我很肯定該服務器上存在某種配置,該配置導致Application_Start()
無法啟動,但是我不確定它是什么。
我已經閱讀並嘗試了以下建議的方法,但到目前為止還沒有運氣:
這讓我發瘋。 請幫忙。 謝謝!
編輯:根據您的要求,這是我的整個global.asax:
<%@ Application Language="C#" Inherits="WebFramework.GlobalBase" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.Http" %>
<%@ Import Namespace="System.Web.Mvc" %>
<%@ Import Namespace="System.Web.Routing" %>
<%@ Import Namespace="System.Reflection" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
EventLogging.LogEvent("Application_Start() fired in Global.asax.", EventLogging.LogLevel.Basic);
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
Application["ApplicationName"] = "My Application";
EventLogging.LogVerbose("Application_Start() - ApplicationName: " + (Application["ApplicationName"] ?? "NA"));
}
void Application_End(object sender, EventArgs e)
{
// Code that runs on application shutdown
}
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
}
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
}
void Session_End(object sender, EventArgs e)
{
// Code that runs when a session ends.
// Note: The Session_End event is raised only when the sessionstate mode
// is set to InProc in the Web.config file. If session mode is set to StateServer
// or SQLServer, the event is not raised.
}
public override string GetVaryByCustomString(HttpContext context, string custom)
{
if (custom.ToLower() == "sessionid")
{
return context.Session.SessionID;
}
return base.GetVaryByCustomString(context, custom);
}
</script>
注意:GlobalBase.cs基本上是一個不執行任何操作的CS文件。
這是Windows問題! 安裝最新的Windows Server 2012 R2更新后,此問題不再發生!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.