Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. Bizare web service proxy server issue

Bizare web service proxy server issue

Scheduled Pinned Locked Moved Web Development
helpdatabasesysadmincsharptesting
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mr Brown Shoes
    wrote on last edited by
    #1

    Hi, A little background on the application first. It is a .NET 2.0 win forms app which connects to a .NET 2.0 web service using WSE 3.0. When the user makes requests to login, a login method is called on the web reference. If this throws an error, an attempt is made to log the error to a database using another method on the web reference. If this fails enterprise exception handling takes over and the error is logged to a local file. Proxy details are set on the web reference before any methods are called (see code at end). The Problem: When the user tries to login an error is thrown stating proxy access denied, an attempt is then made to log this error causing another proxy access denied error. Finally this error is logged in a local text file. The Bizare Part: Even with the errors described above, the web service still records in the DB that the user logged in, and still records in the error log table "Proxy Access Denied" even though it had to go through the proxy to record the login and to log that error??? The Exact Error (logged in the database using the web service): System.Net.WebException: The request failed with HTTP status 407: Proxy Access Denied. at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at xx.Input.localhost.xxServicesWse.GetLoginData(String userName, String password) at xx.Input.Data.UserDataManager.login(String uName, String pWrd) at xx.Input.GUI.xxInput.loginInterface_login(Object sender, LoginArgs le) Where do I go from here to solve this proxy problem. Note that testing the system on a network without a proxy works fine, even if the client contacts the web service accross the internet. The Code: (returns the web reference used through the client) using System; using System.Collections.Generic; using System.Text; using xx.Input.localhost; using System.Net; namespace xx.Input.Web_Service { internal class ServiceProxyFactory { public static xxServicesWse GetxxService() { xxServicesWse xxServices = new xxServicesWse(); //Add a cookie to the web service to allow the use of session on the server side System.Net.CookieContainer cookies = new System.Net.CookieContainer(); xxServices.CookieContainer = cookies; //Set up credentials for a possible prox

    M 1 Reply Last reply
    0
    • M Mr Brown Shoes

      Hi, A little background on the application first. It is a .NET 2.0 win forms app which connects to a .NET 2.0 web service using WSE 3.0. When the user makes requests to login, a login method is called on the web reference. If this throws an error, an attempt is made to log the error to a database using another method on the web reference. If this fails enterprise exception handling takes over and the error is logged to a local file. Proxy details are set on the web reference before any methods are called (see code at end). The Problem: When the user tries to login an error is thrown stating proxy access denied, an attempt is then made to log this error causing another proxy access denied error. Finally this error is logged in a local text file. The Bizare Part: Even with the errors described above, the web service still records in the DB that the user logged in, and still records in the error log table "Proxy Access Denied" even though it had to go through the proxy to record the login and to log that error??? The Exact Error (logged in the database using the web service): System.Net.WebException: The request failed with HTTP status 407: Proxy Access Denied. at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at xx.Input.localhost.xxServicesWse.GetLoginData(String userName, String password) at xx.Input.Data.UserDataManager.login(String uName, String pWrd) at xx.Input.GUI.xxInput.loginInterface_login(Object sender, LoginArgs le) Where do I go from here to solve this proxy problem. Note that testing the system on a network without a proxy works fine, even if the client contacts the web service accross the internet. The Code: (returns the web reference used through the client) using System; using System.Collections.Generic; using System.Text; using xx.Input.localhost; using System.Net; namespace xx.Input.Web_Service { internal class ServiceProxyFactory { public static xxServicesWse GetxxService() { xxServicesWse xxServices = new xxServicesWse(); //Add a cookie to the web service to allow the use of session on the server side System.Net.CookieContainer cookies = new System.Net.CookieContainer(); xxServices.CookieContainer = cookies; //Set up credentials for a possible prox

      M Offline
      M Offline
      Mr Brown Shoes
      wrote on last edited by
      #2

      The following code seems to work: IWebProxy iwp20 = WebRequest.DefaultWebProxy; string requestURL = Properties.Settings.Default.xxInput_localhost_xxServices; string proxyAddress = iwp20.GetProxy(new Uri(requestURL)).ToString(); if (!proxyAddress.Equals(requestURL)) { WebProxy myProxy = new WebProxy(); myProxy.Address = new Uri(proxyAddress); myProxy.Credentials = CredentialCache.DefaultCredentials; xxServices.Proxy = myProxy; } Now I just have to figure out how to get the auto upgrade feature of click once deployment working through the proxy server.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups