How do I get localhost/ to point to localhost/index.html?
Accessing index.html directly works fine, but when accessing the site root, I get the following error:
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.33440
I looked in the IIS Express config file (%userprofile%\documents\iisexpress\config\applicationhost.config) but don't see what could be wrong.
This is the virtual directory information for my project:
<site name="MySite" id="12">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\username\path\to\project\projectname" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:90210:localhost" />
</bindings>
</site>
And in the <system.webServer>
part, it includes:
<defaultDocument enabled="true">
<files>
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="index.html" />
<add value="iisstart.htm" />
<add value="default.aspx" />
</files>
</defaultDocument>
I added routes.IgnoreRoute(""); in RouteConfig.cs to allow localhost/ to serve localhost/index.html. Anyone know why this works?
check if you have defdoc module in the globalModules list.
<globalModules>
<add name="DefaultDocumentModule" image="...\defdoc.dll" />
......
</globalModules>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With