Maybe, maybe not. Don't take offense but it seems to me that instead of
trying to find the root of the problem and to solve it, you're simply
trying out some random tricks to get around the problem. Even if you manage
to get your WindowForm application to run under the LocalService account
and even if it *seems* to work this way, the problem will still be there.
If I understand you properly, the computer on which your application runs
needs to go through a proxy server in order to access the Web Service. Your
Windows Service application automatically picks up the proxy server
configuration when it connect but your WindowForm application doesn't. What
about looking at the APIs that allow you to retrieve the proxy server info
from, for example, Internet Explorer's settings and set this info when
connecting to a Web Service? That would sound a lot more sensible to me
than trying to run your application under some random user account that
you've found always worked for some reason you can't explain.
no offense taken...hehehe
this part of taking the proxy config from IE i already do...here is my
code:
if(CboProxy.Checked)
{
WebProxy Proxy = new WebProxy(TxtIPProxy.Text,
Convert.ToInt32(TxtPortaProxy.Text));
Proxy.BypassProxyOnLocal = true;
STA.Proxy = Proxy;
CredentialCache cache = new CredentialCache();
// Verifica o overload correto das credenciais
if(TxtUsuario.Text == "" && TxtDominio.Text == "")
cache.Add( new Uri(STA.Url), "Negotiate", new
NetworkCredential());
else if(TxtDominio.Text == "")
cache.Add( new Uri(STA.Url), "Basic", new
NetworkCredential(TxtUsuario.Text, TxtSenha.Text));
else
cache.Add( new Uri(STA.Url), "Negotiate", new
NetworkCredential(TxtUsuario.Text, TxtSenha.Text, TxtDominio.Text));
STA.Credentials = cache;
STA.Proxy.Credentials = cache;
}
else
{
STA.Credentials = System.Net.CredentialCache.DefaultCredentials;
}
and i can't predict in what computer it will run...and if will run on
a Vista, XP, 2003 server, 2000 server...and if will use a proxy or
not...
it will be installed in a lot of locations...
and about change the LocalService permissions, sometimes the client
may not agree with that..
i need only to run my Win App with a LocalService account...