Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: IIS6 C# ASP.NET Visual-Studio , +
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 8-Oct-12 8:04am
Comments
Member 4024322 at 8-Oct-12 13:42pm
   
Tried it but got the same result :(
Teenustar at 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

Rate this: bad
good
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.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 410
1 Jochen Arndt 200
2 Richard MacCutchan 135
3 DamithSL 105
4 PIEBALDconsult 90
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,032
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,220


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 10 Oct 2012
Copyright © CodeProject, 1999-2014
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