1

One of the IIS configuration options is how much error detail goes to the client's browser.

It is clear why one would want their own development servers and not pass detail error messages to the public from their production servers.

How do you setup IIS to send the errors to specific hosts - like the developer's IP address for example? I do not want to remote desktop to the server just to see what the real error is on the application.

Alternative I'm thinking of is setting up another website on the same server and granting access to only specific hosts. This website will act as a reverse proxy to the website I am trying to get detailed errors out of, but that seems more complicated than it should be.

1 Answer 1

1

Using the standard IIS settings only lets you distinguish between the local server and any remote machine. There is no way to allow certain remote machines to get detailed errors while others don't.

There is a trick how you can do this anyways.

Your idea about having a second site for development is already spot on, ideally you want a single site with all your application files but you want two different web.configs to define your error settings.

Having a single site but two configs is not possible, but the IIS configuration system is hierarchical and you can store most settings in more than one place.

Create two web sites both pointing to the same physical location.

Rather than putting your settings into the local web.config, you put <system.web><customErrors> into the global web.config %systemroot%\Microsoft.NET\Framework64\v4.0.30319\Config\web.config and <system.webServer><httpErrors> into %systemroot%\System32\inetsrv\config\applicationHost.config in both cases you surround these settings with a location tag such as:

<location path="ProdSite">
    <system.web>
        <customErrors mode="On" />
    </system.web>
</location>

<location path="DevSite">
    <system.web>
        <customErrors mode="Off" />
    </system.web>
</location>

You can still use the IIS Manager to do this, in the Management section of the site, open the Configuration Editor and drill down to the settings you want to change, at the top change the From drop-down to Root Web.Config or ApplicationHost.config

enter image description here

Still not super-easy, but you get away with a single web site.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .