Asp.net 全局asax误差
我突然犯了一个错误:Asp.net 全局asax误差,asp.net,Asp.net,我突然犯了一个错误: 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 appropri
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
我找到了原因:我已经重命名了我的主名称空间,我想VS会处理它。您的
继承的属性是否与当前的代码隐藏名称空间匹配,如果不匹配,您确定它编译正确吗?在DLL中找不到这种情况将发生的类型,例如,项目中不包含代码文件等。谢谢,我找到了原因,最后见下文。
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.
}
}
}