I am trying to deploy an Angular 7
application with .NET Core
using Kestrel
using the FileProvider
extension.
I have created the angular app , i have ng build
it and i copied the files inside dist
.NET
Porject.
Startup
public void Configure(IApplicationBuilder app, IHostingEnvironment env) {
string jsFolderName = "myroot";
string prodRoot =Path.Combine(AppDomain.CurrentDomain.BaseDirectory,jsFolderName);
string debugRoot =Path.Combine(Directory.GetCurrentDirectory(),jsFolderName);
var isDev=env.IsDevelopment();
DefaultFilesOptions options = new DefaultFilesOptions();
options.DefaultFileNames.Clear();
options.DefaultFileNames.Add("/myroot/index.html");
app.UseDefaultFiles(options);
app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions() {
FileProvider = new PhysicalFileProvider(isDev?debugRoot:prodRoot),
RequestPath = "/app"
});
if (env.IsDevelopment()) {
app.UseDeveloperExceptionPage();
} else {
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseMvc();
}
P.S My myroot
folder is right in the root of the project.
I do not know how to feed the first page (entrypoint) of the angular
app which is index.html
.