我知道这个错误非常常见,但我尝试将解决方案应用于此问题,但无法解决这个问题(407)需要代理身份验证(ISA服务器需要授权才能完成请求,拒绝访问Web代理筛选器
那是我的代码:
var endpoint = new EndpointAddress(new Uri("http://www3prz.bancobonsucesso.com.br/Servicos/app.svc"), EndpointIdentity.CreateDnsIdentity("bancobonsucesso.com.br"));
var binding = new WSHttpBinding();
binding.UseDefaultWebProxy = true;
binding.Security.Mode = SecurityMode.Message;
binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
binding.Security.Message.EstablishSecurityContext = true;
binding.Security.Message.NegotiateServiceCredential = true;
var customBinding = new CustomBinding(binding);
SymmetricSecurityBindingElement security = customBinding.Elements.Find<SymmetricSecurityBindingElement>();
security.LocalClientSettings.MaxClockSkew = TimeSpan.MaxValue;
security.LocalClientSettings.DetectReplays = false;
SecureConversationSecurityTokenParameters secureTokenParams = (SecureConversationSecurityTokenParameters)security.ProtectionTokenParameters;
SecurityBindingElement bootstrap = secureTokenParams.BootstrapSecurityBindingElement;
bootstrap.LocalClientSettings.MaxClockSkew = TimeSpan.MaxValue;
bootstrap.LocalClientSettings.DetectReplays = false;
ws = new ServicoClient(customBinding, endpoint);
ws.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
ws.ClientCredentials.UserName.UserName = "test";
ws.ClientCredentials.UserName.Password = "test";
var return = ws.EmitirBoleto("test");
你真的需要做的不仅仅是张贴一大堆代码的转储和错误信息。与我们交谈。你说你已经尝试了一堆东西,好吧,你试过了什么?你有什么看法没有帮助?你究竟在做什么,这是行不通的?实际发生的错误是什么?它总是发生,还是有时?如果有时候,你知道什么时候发生? – Servy
错误发生在“ws.EmitirBoleto(”test“)”行上。 无处不在,提示是使用“binding.UseDefaultWebProxy = true”,但错误在使用或不使用此选项时保持不变。 如果我在没有代理的机器上运行,完美工作,但是当我在Internet Explorer中设置代理时,开始发出此错误。 我希望我已经更清楚了。 – Marquinho
您应该将所有这些信息编辑为实际问题,而不是将其作为评论。 – Servy