使用.NET Core 3 MVC,我的端点捕获了favicon.ico并通过“ Card”控制器和“ Get”操作加载它。
有办法防止这种情况吗?
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "card",
pattern: "{url}",
defaults: new { controller = "Card", action = "Get", url = "" });
我曾经能够使用“ .IgnoreRoute”,但似乎找不到与“ .UseEndpoints”等效的东西
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });