I'm seeing a lot of the same exceptions in Application Insights for HEAD requests for many paths on my website:
System.ArgumentException: The leading '?' must be included for a non-empty query. (Parameter 'value')
The website is running in Azure App Service. When I debug locally and hit those same URLs with a HEAD request, it returns a 405 Not Implemented, but no exceptions. Perhaps because local is using Kestrel and Azure is using IIS?
I am specifying routes like this:
endpoints.MapControllerRoute(
name: "home-test",
pattern: "home/test",
defaults: new { controller = "Home", action = "Test" });
endpoints.MapControllerRoute(
name: "home-test-id",
pattern: "home/test/{id}",
defaults: new { controller = "Home", action = "Test" });
And my controller action looks like this:
[HttpGet]
public async Task<IActionResult> Test(string id)
What's the best way to resolve these exceptions?