0

I've been tearing my hairs out over this one. Found many similar references on StackOverflow and the internet, but nothing seems to help me.

I just keep on getting "Directory Listing Denied" when opening the website, and "This type of page is not served" when requesting a specific .cshtml file.

What I do is the following:

  • In Visual Studio 2010, I select File > New Web Site > ASP.NET Web Site (Razor)
  • Following http://haacked.com/archive/2011/05/25/bin-deploying-asp-net-mvc-3.aspx, I selected "Add Deployable Assemblies" and choose "ASP.NET Web Pages with Razor syntax".
  • I published the site to C:\inetpub\wwwroot\WebSite.
  • In IIS7 on my development machine (Windows 7), I converted the published folder to an application, and set the application pool to "ASP.NET v4.0".
  • Testing localhost/website, everything works fine.
  • Then I copied the whole folder to the remote machine, which runs Windows Server 2003 and IIS 6.
  • In IIS6, I created an application of the folder, and assigned a .NET 4 application pool.
  • When I open the website, I get a "Directory Listing Denied" error message.
  • When I try to open the Default.cshtml file, I get a "This type of page is not served".

It seems to me that all the required DLLs are included in the Bin folder (included by the "Add Deployable Assemblies" option):

  • Microsoft.Web.Infrastructure
  • NuGet.Core
  • System.Web.Helpers
  • System.Web.Razor
  • System.Web.WebPages
  • System.Web.WebPages.Administration
  • System.Web.WebPages.Deployment
  • System.Web.WebPages.Razor
  • WebMatrix.Data
  • WebMatrix.WebData

The .NET versions reported on the "This type of page is not served" error page are: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272.

What am I overlooking?

Peter
  • 2,874
  • 2
  • 31
  • 42

2 Answers2

1

I've found the answer! It's incredible how long I've had to search for this...

The problem was that the "root" website (my webapp is in a folder underneath the main web folder) had a Web.config file which contained the following:

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

This meant that .cshtml webpages were disabled for any website created underneath the main one...

Peter
  • 2,874
  • 2
  • 31
  • 42
0

Have you set the permissions for the website? I think you right click on it and click "Edit Permissions" Also for the error "This type of page is not served" In IIS in default documents add default.cshtml if it does not exist.