他的页面类型没有提供。 (CSHTML)如何为他们服务? [英] his type of page is not served. (CSHTML) how to serve them?

查看:144
本文介绍了他的页面类型没有提供。 (CSHTML)如何为他们服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图显示一个简单的cshtml文件(即example.com/text.cshtml)但是我一直收到这个错误:

这类页面没有提供。



描述:您所请求的页面类型未被提供,因为它已被明确禁止。扩展名.cshtml可能不正确。



有人能告诉我如何在iis7中提供这些类型的文件吗?

解决方案

通常,这表示应用程序池设置不正确。 Razor语法仅适用于ASP.NET 4.0,并且需要集成管道才能正常运行。但是,您还需要在服务器上使用适当的ASP.NET MVC文件 - 在GAC中或部署到本地/ bin文件夹。大多数人在他们的开发系统上都有ASP.NET MVC GAC,因此应用程序将在本地工作,而无需在Web应用程序的/ bin文件夹中使用适当的DLL。但这不一定是服务器端的情况。根据Microsoft的建议,ASP.NET MVC在服务器上不是GAC,因为可能存在对共享主机上运行的所有站点产生广泛影响的版本问题。相反,建议将 bin部署ASP.NET MVC DLL 发送到每个站点。一旦相应的DLL位于/ bin文件夹中,并且应用程序在ASP.NET 4.0 Integrate Pipeline下运行,IIS将提供使用Razor语法编写的文件。






您需要依赖服务器。此讨论可能对您有所帮助:在WebServer上安装MVC [ ^ ]



错误信息说你有没有配置IIS来执行Razor文件。尝试在服务器上安装MVC / Framework4(如果没有安装)。另请查看此链接 [ ^ ]



希望以上链接可以帮助你,



谢谢

-Amit Gajjar


将此添加到web.config似乎修复了问题:

< add key = 网页:启用 value = < span class =code-keyword> true / >


Ive been trying to display a simple cshtml file (ie. example.com/text.cshtml) But I keep getting this error:
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.

Can anybody tell me how to served those type of files in iis7?

解决方案

Normally, this is indicative of incorrect Application Pool settings. Razor syntax only works with ASP.NET 4.0 and requires the Integrated Pipeline to function properly. However, you also need to appropriate ASP.NET MVC files on the server – either in the GAC or deployed to your local /bin folder. Most people have ASP.NET MVC GAC’d on their development systems, so the application will work locally without having the appropriate DLL’s in the /bin folder of the web application. But that’s not necessarily the case on the server side. Per Microsoft’s recommendation, ASP.NET MVC is not GAC’d on the servers as there could be version issues that have a wide impact on all sites running on a shared host. Rather, it is recommended to bin deploy ASP.NET MVC DLL’s to each site. Once the appropriate DLL’s are in the /bin folder, and the app is running under ASP.NET 4.0 Integrate Pipeline, IIS will serve files written with Razor syntax.


Hi,

You need required dependency on the server. This discussion may help you : Install MVC on WebServer[^]

Error message says that you have not configured IIS to execute Razor files. Try to install MVC/Framework4 on server(if not installed). Also check this link[^]

Hope above link helps you,

Thanks
-Amit Gajjar


Adding this to the web.config seemed to fix the problem:

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


这篇关于他的页面类型没有提供。 (CSHTML)如何为他们服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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