webclient using proxy?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nathan

    #1

    webclient using proxy?

    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 NetworkCredenti al(http_user, http_passwd)

    wc.Credentials = myCredentials

    If File.Exists(loc al_dir & file_name) Then File.Delete(loc al_dir &
    file_name)

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



    --
    Regards,

    nathan


  • Steve

    #2
    Re: webclient using proxy?

    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
    "proxyenabl e" 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,C CNA


    Nathan wrote:
    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 NetworkCredenti al(http_user, http_passwd)
    >
    wc.Credentials = myCredentials
    >
    If File.Exists(loc al_dir & file_name) Then File.Delete(loc al_dir &
    file_name)
    >
    wc.DownloadFile (URL & file_name, local_dir & file_name)
    >
    >
    >

    Comment

    • Martin Honnen

      #3
      Re: webclient using proxy?

      Nathan wrote:
      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 = GlobalProxySele ction.GetEmptyW ebProxy()
      I think.



      --

      Martin Honnen --- MVP XML
      http://JavaScript.FAQTs.com/

      Comment

      • Nathan

        #4
        Re: webclient using proxy?

        Sweet! That did the trick. Thanx


        "Steve" <lnuxguy_NOMAIL _PLEASE_@gmail. comwrote in message
        news:uP1SsJL6HH A.5316@TK2MSFTN GP04.phx.gbl...
        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
        "proxyenabl e" 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,C CNA
        >
        >
        Nathan wrote:
        >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 NetworkCredenti al(http_user, http_passwd)
        >>
        >wc.Credentia ls = myCredentials
        >>
        >If File.Exists(loc al_dir & file_name) Then File.Delete(loc al_dir &
        >file_name)
        >>
        >wc.DownloadFil e(URL & file_name, local_dir & file_name)
        >>
        >>

        Comment

        Working...