Click here to Skip to main content
15,881,413 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.

--Erick
Posted
Comments
Erick Dee 8-Oct-12 13:42pm    
Tried it but got the same result :(
Teenustar 8-Oct-12 15:00pm    
This might help
http://netindonesia.net/blogs/zeddy/archive/2008/08/21/how-to-resolve-targetinvocationexception-error-catching-exception-in-asynchronous-calls.aspx

1 solution

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.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900