Setting ASP.NET Core 2.0 favicon

前端 未结 4 840
感动是毒
感动是毒 2021-02-19 07:17

I\'m trying to add and set favicon.ico.

When I saw a initial project that Visual Studio 2017 make automatically, the favicon.ico file is just in the w

4条回答
  •  既然无缘
    2021-02-19 07:44

    If your favicon.ico file is in wwwroot folder and if you are still getting 404 error when browser try to get favicon.ico, make sure you have app.UseStaticFiles(); in your Startup.cs -> public void Configure(IApplicationBuilder app, IHostingEnvironment env).

    Please read Static files in ASP.NET Core for detail.

    If you add favicon.ico in wwwroot and not in any subfolder, you don't need to add the tag in your html or cshtml.

提交回复
热议问题