0 Comments

 

If you are starting with ASP .NET 5 (1.0.0-rc1-final) and you just want to serve an “index.html”, you can follow these steps:

  • Start Visual Studio 2015
  • File > New > Project…
  • Installed > Templates > Visual C# > Web > ASP.NET Web Application
  • Choose .NET Framework 4.6.1

image

 

  • ASP.NET 5 Templates > Empty

image

 

  • Open project.json and add package dependency “Microsoft.AspNet.StaticFiles”: “1.0.0-rc1-final”:

 

image

 

  • Open Startup.cs and remove the app.Run lines:

image

 

  • In Startup.cs add the follwoing lines in the Configure methode beneath app.UseIISPlatformHandler();:
    • app.UseDefaultFiles();
    • app.UseStaticFiles();
  • Like so:

image

 

 

  • Add an index.html file to the wwwroot folder and add the text “Hello world from html” to the body:

 

image

 

 

 

Press F5 and the a browser should appear showing you the “Hello world from html”

 

image

One Reply to “Starting with ASP .NET 5 (empty project) and static files.”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts