Include IIS virtual directory path in request.uri attribute of transactions in ASP.NET Core #1624
Labels
community
To tag external issues and PRs
feature request
To tag an issue after triage that is a feature instead of TD
version: major
To tag issues that may cause breaking changes or removal of deprecated apis/config
Is your feature request related to a problem? Please describe.
Include IIS virtual directory path in request.uri attribute of transactions in ASP.NET Core
Feature Description
thank you always.
When using .NET Agent, I felt that there was a difference in the transaction request.uri attribute between ASP.NET Core and ASP.NET MVC (ASP.NET Web API2).
In ASP.NET MVC, the IIS virtual directory path is included in the request.uri attribute. In contrast, ASP.NET Core doesn't seem to include the IIS virtual directory path in the request.uri attribute.
I'm using both his ASP.NET MVC and ASP.NET Core IIS applications with .NET Agent, but I think it would be more natural for users to have the same request.uri attribute settings.
Evidence is provided below.
I have created two sample applications.
aspnet-sample
: ASP.NET MVC applicationAccess with a URL like
[http://localhost/aspnet-sample/api/values/]
.aspnet-core-sample
: ASP.NET Core applicationAccess with a URL like
[http://localhost/aspnet-core-sample/weatherforecast]
.NRQL execution result.
For ASP.NET MVC applications, the IIS virtual directory path [aspnet-sample] is included in the request.uri.
On the other hand, for ASP.NET Core applications, the client path [aspnet-core-sample] is not included in the request.uri.
Describe Alternatives
You can change the default behavior by using
SetTransactionUri (.NET agent API)
.https://docs.newrelic.com/jp/docs/apm/agents/net-agent/net-agent-api/set-transaction-uri/
Here's an example of setting it in ASP.NET Core middleware.
GetDisplayUrl (Microsoft.AspNetCore.Http.Extensions.UriHelper)
is a method that combines PathBase and Path to create an entire URL.I can change the safe behavior with the above additional code, but I would be very happy if it was realized as the default behavior of .NET Agent.
Additional context
It's just a guess, but I think it's because the URL path information from ASP.NET Core is stored separately in
HttpRequest.PathBase
andHttpRequest.Path
.https://stackoverflow.com/questions/58614864/whats-the-difference-between-httprequest-path-and-httprequest-pathbase-in-asp-n
Therefore, I think that it will be improved if you change the part that sets request.uri of transaction in .NET Agent of ASP.NET Core to
HttpRequest.PathBase
andHttpRequest.Path
.Priority
Really Want
The text was updated successfully, but these errors were encountered: