webconfig中配置
<compilation debug="true" targetFramework="4.5.1"> <buildProviders> <add extension=".cshtml" type="System.Web.Compilation.PageBuildProvider"/> </buildProviders> </compilation>