-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DNX / ASP 5 - ${aspnet-request:serverVariable result in System.NotSupportedException #39
Comments
That's sloppy documentation. We can't read the server variables in dnx (or AFAIK) |
Yeah I figured as much. In RC1 the remote IP isn't readily accessible on Microsoft.AspNet.Http.HttpContext. I think they plan to fix it for RC2. |
superseded by #44 |
kvpro929
added a commit
to kvpro929/NLog.Web
that referenced
this issue
Oct 30, 2022
Remove nonsupported property from API Fixes NLog/NLog.Web#40, fixes NLog/NLog.Web#39
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The documentation https://github.com/NLog/NLog/wiki/AspNetRequest-layout-renderer
implies that serverVariable works for asp.net5 /coreclr but the source code
https://github.com/NLog/NLog.Web/blob/master/NLog.Web.ASPNET5/LayoutRenderers/AspNetRequestValueLayoutRenderer.cs
explicitly seems to throw an exception :
else if (this.ServerVariable != null)
{
#if !DNX
builder.Append(httpRequest.ServerVariables[this.ServerVariable]);
#else
throw new NotSupportedException();
#endi
For example in my nlog.config, the first 3 parameters work fine but the last two throw internal nlog exceptions (Warn Exception in layout renderer. Exception: System.NotSupportedException: Specified method is not supported.)
From project.json
"dependencies": {
.....
"NLog": "4.4.0-beta1",
"NLog.Config": "4.3.0-beta1",
"NLog.Extensions.Logging": "1.0.0-rc1-final-2016-03-11",
"NLog.Schema": "4.3.0-beta1",
"NLog.Web.ASPNET5": "4.2.1",
.......
The text was updated successfully, but these errors were encountered: