asp.net mvc - Kestrel on AspNet vNext doesnt serve index page under / -


i need able serve 'index.html', under default url /, using kestrel web server. right i'm able access static files full path i.e /index.html

again works on visualstudio, context osx kestrel

this startup.cs

public void configureservices(di.iservicecollection services)  {         services.addmvc();  }   public void configure(iapplicationbuilder app)  {      app.usestaticfiles();      app.usemvc();  } 

the solution have far, redirect inside homecontroller. plain ugly, i'm trying serve static html file, don't want handled application, if possible served directly kestrel.

you need enable defaultfilesmiddleware using usedefaultfiles() , place before call usestaticfiles():

app.usedefaultfiles(); app.usestaticfiles(); 

if don't specify otherwise, middleware uses defaultfilesoptions default, means list of default file names used:

default.htm default.html index.htm index.html 

see msdn


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -