I have build my angular app and the output is wwwroot folder inside my ASP .NET API folder. When I build the app with dotnet watch run, everything works and shows normally, but when I refresh the route localhost:5000/users, it shows me raw json file instead of HTML/CSS content
Console error shows the following message: Content Security Policy: The page’s settings blocked the loading of a resource at https://localhost:5000/favicon.ico (“default-src”);
In network refer-policy says "strict-origin-when-cross-origin" but my cors is set app.UseCors(x=>x.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
My endpoints
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapFallbackToController("Index","Fallback");
});
Fallback Controller
public class FallbackController : Controller
{
public IActionResult Index(){
return PhysicalFile(Path.Combine(Directory.GetCurrentDirectory(),"wwwroot","index.html"),
"text/HTML");
}
}
Index.html from wwwroot folder
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>SocialNetworkSPA</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>
My ASP .NET Core version is 3.1 and Angular 11
Please not that everything is functional and works normally until I refresh the page, then these error occurs
