How do I correct visitor IP with Microsoft IIS?

For IIS 7 - 8:

Follow the directions here.

For IIS 8.5 - 10:

From IIS 8.5 onwards, custom logging is a built-in option. See IIS Enhanced Logging.


1. In IIS Manager, double click on 'Logging' in the actions menu of the site you are working on.

2. After this launches, select W3C as the format and then click Select Fields next to the format drop-down in the Log File sub-section.



3. Click on 'Add Fieldand add as per below




4. Click OK. You should see your new entry reflected under 'Custom Fields'. Click on Apply when you are back in the 'Logging' window.


  1. If this is successful, the log file should now have an underscore like so:



You should also see the change in the fields:

Restart the site, then W3SVC, then the entire instance if the change doesn’t reflect immediately.

Note: When using enhanced logging in IIS 8.5+, it does not restore original visitor IP at the application level.

Not finding what you need?

95% of questions can be answered using the search tool. This is the quickest way to get a response.

Powered by Zendesk