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.