Maybe I just been awake too many hours and totally overseeing something but I am using MVC6 ASP.NET 5.0 to develop an AngularJS website. Inside my wwwroot I have a index.html page and it was working just fine but then applied an update and now all of a sudden I just get a blank white screen: Developer Tools tells me:
Failed to load resource: the server responded with a status of 404 (Not Found)
Inside my startup I have the following:
public void Configure(IApplicationBuilder app)
{
app.UseDefaultFiles(new Microsoft.AspNet.StaticFiles.DefaultFilesOptions() { DefaultFileNames = new[] { "index.html" } });
app.UseMvc();
}
Some reason I am still getting a blank white page and nothing loading when I am debugging.
asax file then BlogList is the default page for my site: routes.
You can set up a default route: routes. MapRoute( "Default", // Route name "", // URL with parameters new { controller = "Home", action = "Index"} // Parameter defaults ); Just change the Controller/Action names to your desired default.
You must also specify app.UseStaticFiles()
. From the docs:
In order for your Web app to serve a default page without the user having to fully qualify the URI, call the
UseDefaultFiles
extension method fromStartup.Configure
as follows. Note that you must still callUseStaticFiles
as well. This is becauseUseDefaultFiles
is a URL re-writer that doesn’t actually serve the file. You must still specify middleware (UseStaticFiles
, in this case) to serve the file.
Just to add to the answer above:
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
...
// Serve the default file, if present.
app.UseDefaultFiles();
app.UseStaticFiles();
...
}
http://docs.asp.net/en/latest/fundamentals/static-files.html
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