So continuing our project we are going start with modification in.net project to run as static files and then start the configuration for webpack and introduction for Angular 4 .
It is necessary to do only few modifications to be able to run ASP .net core project using static pages.
Add reference for the library to use static files at the project .csproj .
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
and then modify Configure method in startup.cs allow the run time to use StaticFiles also to the webserver identify the standard default file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Configure( | |
IApplicationBuilder app, | |
IHostingEnvironment env, | |
ILoggerFactory loggerFactory) | |
{ | |
//webserver to use index.html, default.html | |
app.UseDefaultFiles(); | |
//webserver to use static files | |
app.UseStaticFiles(); | |
if (env.IsDevelopment()) | |
{ | |
app.UseDeveloperExceptionPage(); | |
} | |
} |
https://github.com/americoa/DotNetAngular4WebPack2/tree/second-step
No comments:
Post a Comment