gpt4 book ai didi

asp.net - '/'应用程序中的服务器错误。不提供此类页面

转载 作者:行者123 更新时间:2023-12-04 18:11:55 26 4
gpt4 key购买 nike

我有一个托管人,在其中托管了带有.cshtml扩展名的网页。我的主机是arvixe.com,它提供ASP和.NET托管,但是当我尝试加载网页时,出现此错误消息。

Server Error in '/' Application.

This type of page is not served.

Description: The type of page you have requested is not served because it has been explicitly forbidden. The extension '.cshtml' may be incorrect. Please review the URL below and make sure that it is spelled correctly.

Requested URL: /samples/WoT/Default.cshtml

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.276


我读了一些东西我必须在我的web.config文件中写一些东西才能使其正常工作
像这样
<compilation>
<assemblies>
<add assembly="System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
<buildProviders>
<add extension=".cshtml" type="System.Web.WebPages.Razor.RazorBuildProvider, System.Web.WebPages.Razor"/>
</buildProviders>
</compilation>
但是我尝试了所有操作,将其粘贴在不同的行上,但没有任何效果。我想念或做错了什么?

最佳答案

我相信您不是在使用MVC功能,而是尝试仅在外部 View 或自定义Area文件夹中加载razor View 。

然后,您需要在.Net 4.0中默认禁用的Web.config中启用网页 key 。

<add key="webpages:Enabled" value="true" />

关于asp.net - '/'应用程序中的服务器错误。不提供此类页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12086595/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com