11
votes

Hi I want to publish an MVC 3 site in Windows Server 2008 R2 SP1. I installed MVC 3 and MVC 2. When I created an MVC 2 site, it worked fine but the MVC 3 site did not work. I installed MVC 3 first and when the site did not work, I installed MVC 2 and tested the other (MVC 2) site and every thing was ok. The problems is MVC 3.

ANY HELP PLEASE Here is the error:

Error Summary HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory. Detailed Error Information Module DirectoryListingModule Notification ExecuteRequestHandler Handler StaticFile Error Code 0x00000000 Requested URL https://mywebsite.test.own:443/ Physical Path D:\WebSite Logon Method Anonymous Logon User Anonymous Most likely causes:

A default document is not configured for the requested URL, and directory browsing is not enabled on the server.

Things you can try:

If you do not want to enable directory browsing, ensure that a default document is configured and that the file exists.
Enable directory browsing using IIS Manager.
    Open IIS Manager.
    In the Features view, double-click Directory Browsing.
    On the Directory Browsing page, in the Actions pane, click Enable.
Verify that the configuration/system.webServer/directoryBrowse@enabled attribute is set to true in the site or application configuration file.

Links and More Information This error occurs when a document is not specified in the URL, no default document is specified for the Web site or application, and directory listing is not enabled for the Web site or application. This setting may be disabled on purpose to secure the contents of the server.

View more information »

9
I have the exact same error. ASP.NET MVC 2 applications work but ASP.NET MVC 3 applications do not work. The website complains of no directory listing persmission and no default document, i.e., that it can't find Default.aspx. Obviously, there is no Default.aspx to begin with. I am out of ideas.Umar Farooq Khawaja
@Aladdin - It seems iis is not registered. Check this : stackoverflow.com/questions/2374957/asp-net-mvc-on-iis-7-5Gaurav Arora

9 Answers

13
votes

It looks like the request is going to the static file handler and is not getting into the MVC stack at all. Some things to check...

In the config file do you have runAllManagedModulesForAllRequests set to true on the element?

Are you running in an application pool configured for .NET 4 and Integrated Pipeline mode?

That's all I can think of right now, but if I have other thoughts I'll update the post.

13
votes

For ASP.NET MVC 3.0 on IIS 7.5 Windows Server 2008, I found that I had to run aspnet_regiis -i from the C:\Windows\Microsoft.NET\Framework\<version> folder. This resolved the problem.

6
votes

just in case these solutions did not work for someone, I ran into the same issue and finally tracked it down to a folder under my root directory named the same as an area.

For example, I had an area named "Users" and also a folder under my root directory named the same. So "domain.com/users" was actually pointing to a folder under my root drive instead of an area.

Hope this helps someone!

1
votes

The short answer is that you need to "Bin Deploy" the ASP.NET MVC 3 app.

Please read Bin Deploying ASP.NET MVC 3 with Razor to a Windows Server without MVC. Please also read Bin deploy for MVC 3 with Visual Studio 2010 SP1.

I was able to (partially) solve this problem by installing Visual Studio 2010 SP1 and then utilizing the Add Dependency Assemblies command.

The reason I said that I was able to partially solve this problem is because this solution worked for my local IIS 7.5 on Windows 7 but has not worked for IIS 7 on a Windows Server 2008 R2. I am not sure if the problem is continuing or whether it is not a permissions issue. I have not had the chance to look at it in depth yet. Failed Request Tracing seems to suggest that it is the same issue as before, i.e., 403.14. I will update my answer when I know more.

1
votes
  1. Right click on the your root project node in VS 2010 and select "Add Deployable Dependencies" and then choose:

a) ASP .NET MVC

b) ASP .NET Web Pages with Razor syntax

(Press OK and Publish the project)

  1. The element "runAllManagedModulesForAllRequests" of the web.config should be = "true". (By Default it is TRUE)

  2. Under IIS 7.5 "Basic Settings" check if the website has Application pool like "ASP.NET v4.0"

  3. Make sure if you downloads ALL files from the BIN folder. Sometimes FileZilla gets stuck... So, check it twice.

I hope this will help! :)

1
votes

I had the same problem on Server 2008 x64 version. ASP.NET MVC3 site does not work. I check everything in IIS. The problem was solved only after turning on HTTP Redirection service in IIS role.

For Windows 7 check this location: Windows Features -> Internet Information Services -> World Wide Web Services -> Common HTTP features -> HTTP Redirection.

0
votes

My actual problem was that I had mucked around with the _ViewStart.cshtml and _Layout.cshtml files. Specifically, I had changed the name of the _Layout.cshtml file to _PageLayout.cshtml and amended the references to it in _ViewStart.cshtml.

That worked on VS2010 and on my home machine running Windows 7 32-bit, but it did not work on either my work machine running Windows 7 64-bit or my development server running Windows Server 2008 R2.

The solution for me was to now try to change the name of _Layout.cshtml file.

0
votes

I was receiving this error when I deployed the Microsoft tutorial application ContsosoUniversity exactly according to the tutorial guidelines (http://www.asp.net/mvc/tutorials/deployment). After trying all the recommendations of multiple posts I resolved this problem by deleting all other applications in the root directory (from within IIS Manager) and re-deploying the application. One of the other applications in the DefaultAppPool (within which it runs) must have been interfering.