"/"应用程序中的服务器错误.不提供此类页面 [英] Server Error in '/' Application. This type of page is not served

查看:51
本文介绍了"/"应用程序中的服务器错误.不提供此类页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have an host where I hosted a webpage with .cshtml extension. My host is arvixe.com that provides ASP and .NET hosting but when I try to load my web page I get this error message.

"/"应用程序中的服务器错误.

Server Error in '/' Application.

不提供此类页面.

说明:由于明确禁止了您请求的页面类型,因此无法提供.扩展名".cshtml"可能不正确.请查看下面的URL,并确保其拼写正确.

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.

请求的网址:/samples/WoT/Default.cshtml

Requested URL: /samples/WoT/Default.cshtml

版本信息:Microsoft .NET Framework版本:4.0.30319;ASP.NET版本:4.0.30319.276

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

我读了一些东西,我必须在我的web.config文件中写一些东西才能使其正常工作像这样

I read something does I have to write something in my web.config file to make it work like this

<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>

但是我尝试了所有操作,将其粘贴到不同的行中,但没有任何效果.我想念或做错了什么?

But I tried everything, paste it in on different lines, nothing worked. What do I miss or do wrong?

推荐答案

我相信您不是在使用MVC功能,而是尝试仅在外部视图或自定义Area文件夹中加载剃刀视图.

I believe you are not making using the MVC feature and trying to load just the razor view outside views or custom Area folders.

然后,您需要在.net 4.0中默认禁用的Web.config中启用网页密钥

Then you need to enable webpages key in Web.config which is disabled by default in .Net 4.0

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

这篇关于"/"应用程序中的服务器错误.不提供此类页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆