Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Updated 12-Nov-17 23:54pm
Comments
[no name] 8-Aug-12 22:27pm    
Go into your IIS and configure it.

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.
 
Share this answer
 
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
 
Share this answer
 
Comments
Zumicts 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 10-Aug-12 6:25am    
welcome.
XML
Adding this to the web.config seemed to fix the problem:

<add key="webpages:Enabled" value="true" />
 
Share this answer
 
Comments
Debra A. Hodges 29-Oct-15 12:36pm    
Thank you.
Member 12610490 1-Mar-19 2:51am    
thxs
Question: This type of page is not served. It is explicity forbidden.
I had same issue. Now my issue is solved.
Hi,

Step 1: Make a home page (start page)
note: You cannot make a master page a start page.
This will work.

In case if it doesnt work.
right click, the folder that you create a website

go for -> start page option -> change the version to 3 or 4 or 4.5

Try this

Thanks
G Ranjith kumar
 
Share this answer
 
Comments
Deepu S Nair 13-Nov-17 6:03am    
You are answering a question which is nearly 5 years old and already solved.It may attract downvoting your answer.Please try to answer new questions.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900