webclient using proxy?

N

Nathan

Have a strange problem.
Creating a windows service running under the Local Sytem account.
I have a Webclient that downloads a file from the internet.
The code works fine if executed from a windows form but when i execute it in
a windows service i get the following error:
The proxy name could not be resolved: 'macc4'

'macc4' is a proxy server i have used in IE in the past at work, but why in
the world is the webclient trying to use this proxy server???

Can anyone shed some light on what might be going on?

Dim wc As New WebClient

Dim myCredentials As New NetworkCredential(http_user, http_passwd)

wc.Credentials = myCredentials

If File.Exists(local_dir & file_name) Then File.Delete(local_dir &
file_name)

wc.DownloadFile(URL & file_name, local_dir & file_name)
 
S

Steve

Sounds like the web service created a user profile to get internet
settings from, which would have been based off the default user profile.
Search the default profile in regedit for "macc4", and check the
"proxyenable" key to make sure it's a 0. Then, delete the "Local System"
profile on the hard drive, and rerun the service.


Steve C.
MCSD,MCAD,MCSE,MCP+I,CNE,CNA,CCNA
 
M

Martin Honnen

Nathan said:
Have a strange problem.
Creating a windows service running under the Local Sytem account.
I have a Webclient that downloads a file from the internet.
The code works fine if executed from a windows form but when i execute it in
a windows service i get the following error:
The proxy name could not be resolved: 'macc4'

'macc4' is a proxy server i have used in IE in the past at work, but why in
the world is the webclient trying to use this proxy server???

Can anyone shed some light on what might be going on?

Dim wc As New WebClient

We can't tell you why that particular proxy is used but .NET uses the IE
proxy settings.
Details are here:
<URL:http://msdn2.microsoft.com/en-us/library/fze2ytx2.aspx>

If you don't want to use a proxy then one way is by setting
wc.Proxy = GlobalProxySelection.GetEmptyWebProxy()
I think.
 
N

Nathan

Sweet! That did the trick. Thanx


Steve said:
Sounds like the web service created a user profile to get internet
settings from, which would have been based off the default user profile.
Search the default profile in regedit for "macc4", and check the
"proxyenable" key to make sure it's a 0. Then, delete the "Local System"
profile on the hard drive, and rerun the service.


Steve C.
MCSD,MCAD,MCSE,MCP+I,CNE,CNA,CCNA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top