web.config 编译错误
web.config error in compilation
在 MVC .net Framework 4.5 中,我对部分视图操作方法进行了 JQuery Ajax POST 调用。
但是,它会重定向到一个动作,我是 RouteConfig 文件顶部的一个路由:
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Dashboard", action = "Index", id = UrlParameter.Optional }
);
它给出了这个错误:
"public method was not found on controller"
在这行代码中:
Html.RenderAction("GetRate", "Exchange", new { area = "ExchangeArea" });
在Global.asax
Error executing child request for handler
'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.'
我继续看到实际错误,是:
解析器错误消息:
Unrecognized element 'compilation'.
来源错误:
<customErrors mode="Off" redirectMode="ResponseRewrite">
Line 89: <compilation debug="true"/>
Line 90: <error statusCode="404" redirect="~/HTML404.cshtml"/>
Line 91: </customErrors>
如前所述,请从 ajax post 调用的控制器操作中删除 HttpGet 属性。
在 MVC .net Framework 4.5 中,我对部分视图操作方法进行了 JQuery Ajax POST 调用。
但是,它会重定向到一个动作,我是 RouteConfig 文件顶部的一个路由:
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Dashboard", action = "Index", id = UrlParameter.Optional }
);
它给出了这个错误: "public method was not found on controller" 在这行代码中:
Html.RenderAction("GetRate", "Exchange", new { area = "ExchangeArea" });
在Global.asax
Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.'
我继续看到实际错误,是:
解析器错误消息:
Unrecognized element 'compilation'.
来源错误:
<customErrors mode="Off" redirectMode="ResponseRewrite"> Line 89: <compilation debug="true"/> Line 90: <error statusCode="404" redirect="~/HTML404.cshtml"/> Line 91: </customErrors>
如前所述,请从 ajax post 调用的控制器操作中删除 HttpGet 属性。