1

I have two applications setup in IIS7.5. MVC 3 is installed. One application serves Razor files fine. A separate application was recently created that will not serve Razor files. I get the following error when accessing the file using the full filename (file.cshtml):

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.

When trying to access the file without an extension (/path/file/) I get a 404 error.

I have searched for this problem but haven't found a solution where it works with one application but not another on the same server.

Both applications are using the same App Pool.

Web.Config files are identical.

NickF
  • 40
  • 6

1 Answers1

4

Do both sites have a CSHTML file in the root of the application? Since the WebPages framework (which is what is used when you request a CSHTML file directly) has a significant impact on your site's performance if you aren't using it, we only start it if there's a CSHTML file in the root folder of your site (i.e. ~/Foo.cshtml). If you don't have any CSHTML files in your root, you can also add a web.config entry to set an appSetting:

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

If you're confused by my answer, it would help if you edited your question to add information about the file layout of the two apps. Then I can add some concrete examples to try and clarify things :).

Hope that helps!

Andrew Stanton-Nurse
  • 6,274
  • 1
  • 28
  • 20