ASP.NET allow anonymous access to OData $metadata when site has global AuthorizeAttribute
问题 I have an ASP.NET OData site that has the following in the WebApiConfig file: config.Filters.Add(new AuthorizeAttribute()) This forces all callers to authenticate before calling any of the controllers. Unfortunately, this also forces user authentication to access the "$metadata" url. I need to globally force authentication for all controller access while also allowing anonymous access the the "$metadata" url. 回答1: Create a custom filter that derives from AuthorizeAttribute and override the