Partager via


Troubleshooting: Microsoft.AspNetCore.HttpOverrides.ForwardedHeadersMiddleware and Parameter count between X-Forwarded-For and X-Forwarded-Proto errors

With Microsoft Dynamics NAV 2018, if the Dynamics NAV Web Server is hosted on an IIS server farm that is using Application Request Routing (ARR), you might experience problems accessing the Web client, and the following errors will be recorded in the event log:

Microsoft.AspNetCore.HttpOverrides.ForwardedHeadersMiddleware

Parameter count mismatch between X-Forwarded-For and X-Forwarded-Proto.

Resolution

This error can be caused by a missing header in an ARR routing rule. Dynamics NAV Web Server runs on ASP .NET Core, which requires both an X-Forwarded-For header and X-Forwarded-Proto header. By default, ARR only adds the X-Forwarded-For header; not the X-Forwarded-Proto header.

To resolve this issue, on the server farm in IIS, add or edit a routing rule to include a server variable for X-Forwarded-Proto. For example, using IIS Manager, select Routihg Rules > URL Rewrite > Edit > Server Variables, and then add a server variable that has following settings:

Name Value Replace
HTTP_X_FORWARED_PROTO http ot https true

For more information, see Using URL Rewrite .

See Also

Deploying the Microsoft Dynamics NAV Web Server Components
Troubleshooting the Microsoft Dynamics NAV Web Client Installation
How to: Install the Web Server Components