15 January, 2016
0 Comments
1 category
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
- ASP.NET 5 Templates > Empty
- Open project.json and add package dependency “Microsoft.AspNet.StaticFiles”: “1.0.0-rc1-final”:
- Open Startup.cs and remove the app.Run lines:
- In Startup.cs add the follwoing lines in the Configure methode beneath app.UseIISPlatformHandler();:
- app.UseDefaultFiles();
- app.UseStaticFiles();
- Like so:
- Add an index.html file to the wwwroot folder and add the text “Hello world from html” to the body:
Press F5 and the a browser should appear showing you the “Hello world from html”
Tags: ASP .NETVisual Studio
Category: Uncategorized
One Reply to “Starting with ASP .NET 5 (empty project) and static files.”