Reputation: 131
I'm creating an ASP.NET web app in a corporate environment that uses a .pac file to auto config the WebProxy. I can access external websites just fine through IE, and I also have no problem when running my app through the console, but it is not working when running it through IIS.
From my research I've found that proxy settings are on a per user basis, so I assume the console app is working because it's using my domain user proxy settings, and the IIS web app is failing because it's using the unconfigured LocalSystem proxy settings.
What are my options to get this app to work in IIS?
1) I'm unable to edit the registry on these machines, so I'm unable to copy the user proxy settings into the LocalSystem proxy settings. Is there any other way to copy over settings that doesn't involved editing the registry?
2) I tried enabling Impersonation in an attempt to have IIS use the domain user's proxy settings but that doesn't seem to work. The default WebRequest.DefaultWebProxy and my WebRequests still come out with the wrong proxy. And anyways I'd prefer to not have to turn on Impersonation if it can be avoided.
Any other ideas?
Upvotes: 0
Views: 870
Reputation: 396
If this isn't working using automatic proxy detection, you could provide the proxy configuration in your web.config, e.g.:
<system.net>
<defaultProxy useDefaultCredentials="true">
<proxy usesystemdefault="false" scriptLocation="http://<your_proxy_server>/<pac_file>.pac"/>
</defaultProxy>
</system.net>
Upvotes: 1