Click here to Skip to main content
13,045,641 members (68,831 online)
Rate this:
Please Sign up or sign in to vote.
Hello all,

I'm having this problem with an app I tried to deploy to IIS version 6.1. My code makes an asynchronous call (via a WebClient and delegate code) to retrieve XML data from a remote server, and this is working perfectly fine when I run the app from Visual Studio 2010. However, when I deploy the app to my IIS server, a TargetInvocationException is thrown by this code and the process is stopped as this call is the first step of a long flow of mixed processes, all of which seem to be working fine. I'm deploying the app to the .Net 4 application pool (this is the version in which the code is compiled) but the exception is still thrown. Has any of you had a similar experience where your code produces an exception of this type in IIS but not on your IDE? What could I be doing wrong with the configuration? Any suggestions and/or responses will be highly appreciated, thanks.

Posted 8-Oct-12 7:04am
Member 4024322 8-Oct-12 13:42pm
Tried it but got the same result :(
Teenustar 8-Oct-12 15:00pm
This might help

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Found out what the problem was. The remote server was denying me access (401) because I was sending the DefaultCredentials in the WebClient object. It turns out that they're not the same when using the ASP Development server (your Windows account) than those sent by IIS when the app is deployed, since it sends a username like "IIS APPOOL\YourAppPoolName". Thanks anyway for your replies.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 10 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100