2010-05-16 65 views
2

我突然得到這個錯誤:全球ASAX錯誤

Server Error in '/' Application. 

Parser Error 

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: Could not load type 'MyApp.Global'. 

Source Error: 


Line 1: <%@ Application Codebehind="Global.asax.cs" Inherits="MyApp.Global" Language="C#" %> 

Source File: /global.asax Line: 1 

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1 

我沒有做任何事情來Global.asax中。我試圖從命名空間改變MyFramework到MyApp的,但是它沒有工作,要麼讓我把它放回去喜歡它低於:

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.Security; 
using System.Web.SessionState; 

namespace MyFramework 
{ 
    public class Global : System.Web.HttpApplication 
    { 

     void Application_Start(object sender, EventArgs e) 
     { 
      // Code that runs on application startup 

     } 

     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. 

     } 

    } 
} 
+0

你的'Inherits'屬性和當前的代碼隱藏名稱空間是否匹配,如果不是,你確定它正在編譯?它無法在DLL中找到這種類型,例如代碼文件沒有包含在項目中,等等。 – 2010-05-16 12:32:41

+0

謝謝我發現原因終於看到下面。 – user310291 2010-05-16 12:45:57

回答

1

我已經找到了原因:我已經改名爲我的主要命名空間,我想VS會搞定此事。