我正在尝试部署我的网络项目,但不断收到此错误:
Line 1: <%@ Application Codebehind=“Global.asax.cs” Inherits=“nadeem.MvcApplication” Language=“C#” %>
我看了这个帖子:解析器错误:“/”应用程序中的服务器错误 https://stackoverflow.com/questions/11596352/line-1-application-codebehind-global-asax-cs-inherits-nadeem-mvcapplicat
但在我的项目中这是正确的。
我怀疑这与我的iis7配置有关。
有任何想法吗?
全局.asax:
<%@ Application Codebehind="Global.asax.cs" Inherits="tamal.pelecard.biz.MvcApplication" Language="C#" %>
Global.asax.cs:
namespace TamalTest
{
using System;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
public class MvcApplication : HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
}
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
}
}
}
解决了,改名即可全局.asax或删除它解决了问题:/
我在网上发现的其他已知相关错误:
-
全局.asax.cs: 必须继承自
HttpApplication -> public class MvcApplication : HttpApplication
- 项目输出必须是 bin 文件夹,而不是二进制/调试, etc.
- Iss 应用程序池的 .net 版本不正确。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)