不是网页应用程序 - 我使用了 VisualStudio 2010,它是一个多项目解决方案。
现在 Web 应用程序在 .Net 4.0 中,但其中包含 200 多个 aspx 文件,今天我只是尝试添加一些 Razor 引用,看看它是否可以工作 - 令人惊讶的是,它给了我一种可能的感觉?
这是我制作的 web.config 文件,但它给了我“不提供此类页面”。错误。谁能帮我看看是否可行?
这是我修改后的 web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<connectionStrings>
</connectionStrings>
<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.web.webPages.razor>
<host factoryType="System.Web.WebPages.Razor.WebRazorHostFactory, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.WebPages.WebPage">
<namespaces>
<add namespace="System.Web.WebPages" />
<add namespace="System.Web.WebPages.Html" />
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Routing" />
</namespaces>
</pages>
</system.web.webPages.razor>
<system.web>
<httpRuntime requestValidationMode="2.0" maxRequestLength="1048576000" executionTimeout="99999" />
<customErrors mode="Off" />
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<pages validateRequest="false">
<namespaces>
<add namespace="System.Web.WebPages" />
<add namespace="System.Web.WebPages.Html" />
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Routing" />
</namespaces>
</pages>
<httpHandlers>
<add path="*.cshtml" verb="GET,HEAD,POST,DEBUG" type="System.Web.HttpForbiddenHandler" />
</httpHandlers>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
<add name="PBHttpModule" type="WebCider.PortalBuilder.Framework.Web.Http.PBHttpModule, WebCider.PortalBuilder.Framework.Web" />
</modules>
<directoryBrowse enabled="true" />
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1048576000" />
<fileExtensions>
<add fileExtension=".cshtml" allowed="true" />
</fileExtensions>
</requestFiltering>
</security>
<handlers>
</handlers>
</system.webServer>
<runtime>
</runtime>
</configuration>