asp.net-mvc - 为什么在 asp.net mvc 项目中加载 WebForms 的 ViewEngineCollection

标签 asp.net-mvc asp.net-mvc-4

这是一个使用 Razor ViewEngine(.cshtml 文件)的 asp.net mvc 项目

为什么 WebFormViewEngine 然后加载到内存中?

enter image description here

最佳答案

ASP.NET MVC 3 默认使用 Razor 和 WebForms View 引擎。例如,假设您将带有 WebForms View 的旧 MVC 1 项目移植到 MVC 3。如果您不使用 WebForms,那么您可以在 Global.asax 中安全地删除它:

public class Global : HttpApplication
{
    public void Application_Start()
    {
        ViewEngines.Engines.Clear();
        ViewEngines.Engines.Add(new RazorViewEngine());
    }
}

关于asp.net-mvc - 为什么在 asp.net mvc 项目中加载 WebForms 的 ViewEngineCollection,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11920817/

相关文章:

javascript - 通过jqgrid在MVC中调用Controller的Action

c# - 如果复杂对象具有从字符串隐式转换,则 QueryString 参数是否可以绑定(bind)到复杂对象

c# - ASP.NET OAuth 外部登录 - 默认实现和重新授权

c# - 向 ASP.NET MVC 2 中的页面方法发出 Ajax 请求

.net - .net core mvc 中 session 超时时如何重定向

javascript - 读取单选按钮列表的值

asp.net - 将字符串数组作为参数传递给 asp.net mvc webapi 方法

jquery - ASP.NET MVC - 页面卸载

c# - asp.net mvc 4,线程被模型绑定(bind)改变了吗?

c# - 如何在 WebApi 中添加和获取 Header 值