Click here to Skip to main content
11,715,022 members (69,949 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# IIS
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?
Posted 8-Aug-12 16:17pm
Zumicts521
Comments
Wes Aday at 8-Aug-12 22:27pm
   
Go into your IIS and configure it.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
  Permalink  
Comments
XzRaider27 at 10-Aug-12 6:07am
   
Yeah this did the trick! Didn't have MVC on my server. Thanks for the help both of you!
@amitgajjar at 10-Aug-12 6:25am
   
welcome.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Adding this to the web.config seemed to fix the problem:
 
<add key="webpages:Enabled" value="true" />
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 530
1 Richard MacCutchan 275
2 Maciej Los 259
3 ManasKumarM 155
4 Frankie-C 125
0 Sergey Alexandrovich Kryukov 775
1 CHill60 415
2 Richard MacCutchan 405
3 Maciej Los 389
4 OriginalGriff 320


Advertise | Privacy | Mobile
Web01 | 2.8.150901.1 | Last Updated 19 Nov 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100