在使用剃刀时关闭WebFormViewEngine? [英] Turning off the WebFormViewEngine when using razor?
本文介绍了在使用剃刀时关闭WebFormViewEngine?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我今天上午下载了
I downloaded Glimpse this morning to try it out and noticed this when I click on the views tab:
It checks all of the loaded view engines. I found where the RazorViewEngine
is specified in web.config, but I couldn't find where the WebFormViewEngine
was. Since I know my project will never have an web form view in it,
- Is it ok/safe to turn off
WebFormViewEngine
? - How can I turn off
WebFormViewEngine
?
解决方案
It is perfectly ok to remove the web forms view engine if you are not using it. You can do it like:
public class Global : HttpApplication
{
public void Application_Start()
{
// Clears all previously registered view engines.
ViewEngines.Engines.Clear();
// Registers our Razor C# specific view engine.
// This can also be registered using dependency injection through the new IDependencyResolver interface.
ViewEngines.Engines.Add(new RazorViewEngine());
}
}
The above method calls go in your global.asax file.
source of code
这篇关于在使用剃刀时关闭WebFormViewEngine?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文