Re: "Requested registry access is not allowed" and Web Service call

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Nicole Calinoiu (calinoiu)
Date: 12/15/04


Date: Wed, 15 Dec 2004 11:17:49 -0500

That's the wrong Proxy property. The web service wrapper class generated
for use in the client application inherits from
System.Web.Services.Protocols.WebClientProtocol, even if not directly. You
would need to override its virtual GetWebRequest method to set the value of
the Proxy property for the HttpWebRequest used by the wrapper.
Unfortunately, this change would be undone every time the auto-generated
wrapper class is regenerated. If you have an acceptable workaround that
doesn't compromise the security of your system, it would probably be best to
use it.

HTH,
Nicole

"Clint" <cjmueller@gmail.com> wrote in message
news:1103122155.057204.269070@c13g2000cwb.googlegroups.com...
>I think I'm doing something wrong in that I tried setting the Proxy
> right after creating a new instance of my service:
>
> ws = new HashTest.iisvm03.Service1();
> ws.Proxy = new System.Net.WebProxy("http://foo:80", true);
> ws.CookieContainer = new System.Net.CookieContainer();
> ws.Credentials = System.Net.CredentialCache.DefaultCredentials;
>
> With no success - still trying to read from the registry. I did find a
> work-around, though, in that I'm not always impersonating a user in the
> application, only on remote calls. So, when my calling class fires up,
> it isn't impersonating, and I can set a private proxy field in the
> constructor and use it as needed when I do my calls. That, oddly
> enough, seems to work.
>
> I have no problem going that route, I'm more curious now as to what I
> was doing wrong for future reference. Either way - thanks again for
> helping me out - this has been bugging me for a while!
>
> Clint
>