I know there are a million similar/same questions here (I know that because I've read them) but I just can't figure out why my default document is not displaying. It used to; and if I enable the default web-site then that site's default page is displayed. The HTTP error code is 404.
EDIT: Is it because I'm using "localhost" or top level domain? That is https://localhost/MyDefault.html works but I get a 404 from https://localhost.
I believe/guess something in the following is the issue. It used to work: -
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
<defaultDocument enabled="true">
<files>
<clear />
<add value="MyDefault.html" />
</files>
</defaultDocument>
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
I was looking for 2 days then came across what I thought was the solution but sadly (as fitting as it sounds) it doesn't work :-(
FYI this is a SPA/PWA and when I say mvC it really is Controller only.
Here's the Global.asax part.
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
There is no HOME controller available.
This is the standard error page returned: - 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.8.3752.0
No files created in FRL
This is the 404 error: - 2019-12-04 03:55:34 ::1 GET / - 443 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/78.0.3904.108+Safari/537.36 - 404 0 0 4
Here's the FRT request summary. The complete trace can be found at Complete FRT
[4]:
My reply is too long so I can't post it in comment. I reviewed your log and notice that 404 come from asp.net managed pipeline.And Static file handler even not get involved in this request.
So I think there could be something wrong with your project or extensionless handler ExtensionlessUrlHandler-Integrated-4.0.
First of all, we need to check whether the routes.ignoreroute works fine in visual studio. Did you get 403.14 even there’s no Mydefault.html in your project’s root folder?
Because I notice that you are registering
RouteConfig.RegisterRoutes(RouteTable.Routes)
in global.asax but you didn't include it intoRouteConfig
class. I am used to create separate Route.config to store the route table.If it works fine in VS, have you tried to clean all release files in the root folder and re-publish via VS deployment tool? Did you see staticfile handler in IIS manager handler mapping? Besides, please check whether your application pool identity and IUSR have permission to access Your website's root folder. Since this is not a typical 404 error, we may have to troubleshooting step by step.
Edit: