In my case the problem was in Program.cs file:
I had app.MapStaticAssets();
When I started to use app.UseStaticFiles(); the problem was solved