Foros del Web » Programación para mayores de 30 ;) » .NET »

Error 407 con Proxy al consumir WebService

Estas en el tema de Error 407 con Proxy al consumir WebService en el foro de .NET en Foros del Web. Que tal, pues tengo un problema al consumir un webservice dentro de mi aplicacion, resulta que lo puedo ver desde el navegador, también pude agregar ...
  #1 (permalink)  
Antiguo 28/01/2008, 13:04
 
Fecha de Ingreso: agosto-2006
Mensajes: 45
Antigüedad: 17 años, 8 meses
Puntos: 0
Error 407 con Proxy al consumir WebService

Que tal, pues tengo un problema al consumir un webservice dentro de mi aplicacion, resulta que lo puedo ver desde el navegador, también pude agregar el web reference dentro de mi aplicación y tengo acceso a los métodos dentro de el, pero al momento de ejecutar la aplicacion se dispara una excepción que dice lo siguiente:

"The request failed with HTTP status 407: Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy service is denied. )."

Dentro de las propiedades de LAN de Internet Explorer, tengo configurado que acceda a Internet a través de un Proxy el cual tiene un usuario y un password, pero para poder ver el WebService en el navegador no necesito de ese proxy y excluí en la configuracion de la LAN la direccion donde esta corriendo el webservice, esto lo hice poniendo *.dominio.com.mx en las opciones avanzadas, sin embargo no se si en mi aplicacion deba hacer algo parecido para tener acceso a los datos en tiempo de ejecucion. Mi código para asignar las credenciales al web service es el siguiente


public static void SetNetworkCredentials(System.Web.Services.Protocol s.SoapHttpClientProtocol SC)
{
string wsUser = System.Configuration.ConfigurationManager.AppSetti ngs["AccessPointUser"].ToString();
string wsPassword = System.Configuration.ConfigurationManager.AppSetti ngs["AccessPointPassword"].ToString();
string wsDomain = System.Configuration.ConfigurationManager.AppSetti ngs["AccessPointDomain"].ToString();

System.Net.NetworkCredential networkCredential = new System.Net.NetworkCredential(wsUser, wsPassword, wsDomain);

System.Net.CredentialCache credentialCache = new System.Net.CredentialCache();
credentialCache.Add(new Uri(SC.Url), "Negotiate", networkCredential);//NTLM
SC.UnsafeAuthenticatedConnectionSharing = true;
SC.ConnectionGroupName = "AccessPoint";
SC.Credentials = credentialCache;
}


Alguna Idea????
  #2 (permalink)  
Antiguo 29/01/2008, 11:20
 
Fecha de Ingreso: junio-2003
Ubicación: Asturias
Mensajes: 2.429
Antigüedad: 20 años, 10 meses
Puntos: 7
Re: Error 407 con Proxy al consumir WebService

No se por que tienes tanto ahi, cno esto deberia valerte:

Código:
public static void SetNetworkCredentials(System.Web.Services.Protocol s.SoapHttpClientProtocol SC)
{
string wsUser = System.Configuration.ConfigurationManager.AppSetti ngs["AccessPointUser"].ToString();
string wsPassword = System.Configuration.ConfigurationManager.AppSetti ngs["AccessPointPassword"].ToString();
string wsDomain = System.Configuration.ConfigurationManager.AppSetti ngs["AccessPointDomain"].ToString();

System.Net.NetworkCredential networkCredential = new System.Net.NetworkCredential(wsUser, wsPassword, wsDomain);

tuClaseServicioWeb objServicioWeb = new tuClaseServicioWeb();
objServicioWeb.Credentials = networkCredential;
}

Y deberia funcionarte.

Saludos.
__________________
Charlie.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:42.