Monday, March 26, 2012

ASP.NET MVC 3: A default document is not configured

I ran into a strange issue and so many different solutions have been posted online that I thought I’d add what worked for my scenario. I have an ASP.NET MVC 3 “Razor” web application which I ran successfully on W2K8 R2 and when I tried to open it on Windows 7  (IIS 7.5), it wouldn’t run. The error message was “HTTP Error 403.14 – Forbidden. A default document is not configured for the requested URL.” I know that I don’t need to set a default document, so what is wrong?

image

There are an awful lot of posts about this error, but the key here is that this solution worked fine on one machine and wouldn’t run on another. I found the solution that worked for me on StackOverflow.com. It was the suggestion from Dommer that helped with my issue. (Note that there is a 32bit version of the same fix.)

“did you try running the aspnet_regiis -i command in the Visual Studio 64 bit command prompt (with admin privileges)? When I did that it fixed it for the 64-bit mode. To clarify, I right clicked on Visual Studio x64 Win64 Command Prompt (2010) and chose Run as Administrator. Then I went here: C:\Windows\Microsoft.NET\Framework64\v4.0.30319
And did this: aspnet_regiis –i And now it works perfectly.”

image

Yes, yes it does. Thanks!

7 comments:

Expert SharePoint Consultants Blog said...

I’d have to check with you here. Which is not something I usually do! I enjoy reading a post that will make people think. Also, thanks for allowing me to comment!

Anonymous said...

This was the fix for a vanilla deployment, I forgot to add that registration into my setup notes. It's odd that I installed .NET 4 and MVC 3 after the IIS role and App Server role were installed. You'd think it would've been registered.

Thanks!
Ryan

As blogger said...

Thanks, this really solved my problem!

I don't understand why .NET 4was not installed under Server 2008. In hindsight the app pools only showing .NET 2 were a giveaway (but I had changed these manually to NET4 - with still that error).

So fixed, thank you!

Andrew

Elliott Buckley said...

ASP.NET MVC 3: A default document is not configured is quite a common problem in .net development process but by just putting this post you makes this task very easy for the developers.

Pedro said...

THANKS,thanks...

Unknown said...

Bookmarked for every time I have a machine rebuilt! Thanks a mil!

Neill

PaulHuxe said...

Three days spent on trying to fix this damned error. Without success.

Saw your post. Tested it. Problem solved in less than 3 minutes !


Thanks a lot for this tip. Not easy to begin in ASP.NET MVC...