Have you ever hosted your .NET site on IIS? Both hosting your site on a Windows server and maintaining it in IIS is quite easy, considering both come from Microsoft. If you ever did, you know you can specify your default pages in website properties. But once upon the lifetime of your server, you may encounter a problem that will return you a 404 error when you don’t specifically give your default page in the URL. That is exactly what happened to me after I needed to restart the server and decided to to choose the option of installing updates before the restart (arguably not the smartest move). Well, something freaked out during updates and the server shut down in the middle of the process, which was then resumed at next start up and everything was fine up until I punched in one of the domain names I own. Whoa, a 404 error and a quick check – no, IIS is up, the website is running, the default page is set. It was isolated to .NET websites only, however. So, considering the only change were updates, I have uninstalled them all to no avail. I then uninstalled .NET 4 and .NET 3 completely and reinstalled .NET 4 anew. To no avail.
I googled it more than once during this few-days-hell and there are a lot of people who talk about it, seems to be quite common to a degree. Well, after all my trouble spending quite some time on it, I found a solution on StackOverflow. And simple to the ground it was – a value in a registry that needs to simply be there.
If you are having the same problem, create a
DWORD value named
EnableExtensionlessUrls and keep the default value of
0 for it in
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\4.0.xxxx.xx...\. If it’s already there, just reassign it to 0.
To launch the registry editor, simply run
regedit from the command prompt or from the menu.
I hope this saves a headache and some time for someone 🙂