C# (407)需要代理身份验证(ISA服务器需要授权才能完成请求。对Web代理筛选器的访问被拒绝
我知道这个错误很常见,但我试图将解决方案应用到这个问题上,却无法解决它 这是我的密码:C# (407)需要代理身份验证(ISA服务器需要授权才能完成请求。对Web代理筛选器的访问被拒绝,c#,web-services,proxy,C#,Web Services,Proxy,我知道这个错误很常见,但我试图将解决方案应用到这个问题上,却无法解决它 这是我的密码: var endpoint = new EndpointAddress(new Uri("http://www3prz.bancobonsucesso.com.br/Servicos/app.svc"), EndpointIdentity.CreateDnsIdentity("bancobonsucesso.com.br")); var binding = new WSHttpB
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");
var endpoint=新的端点地址(新Uri(“http://www3prz.bancobonsucesso.com.br/Servicos/app.svc),EndpointIdentity.CreateDnsIdentity(“bancobonsucesso.com.br”);
var binding=新的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=新的customBinding(绑定);
SymmetricSecurityBindingElement security=customBinding.Elements.Find();
security.LocalClientSettings.MaxClockSkew=TimeSpan.MaxValue;
security.LocalClientSettings.DetectReplays=false;
SecureConversationSecurityTokenParameters SecureTokeParams=(SecureConversationSecurityTokenParameters)security.ProtectionTokenParameters;
SecurityBindingElement引导=secureTokenParams.BootstrapSecurityBindingElement;
bootstrap.LocalClientSettings.MaxClockSkew=TimeSpan.MaxValue;
bootstrap.LocalClientSettings.DetectReplays=false;
ws=新的服务客户端(customBinding,端点);
ws.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode=X509CertificateValidationMode.None;
ws.ClientCredentials.UserName.UserName=“测试”;
ws.ClientCredentials.UserName.Password=“测试”;
风险回报率=ws.emitterboleto(“测试”);
在WCF绑定中使用useDefaultWebProxy:
<bindings>
<basicHttpBinding>
<binding name="bindingName" useDefaultWebProxy="true">
WebProxy wproxy = new WebProxy("new proxy",true);
wproxy.Credentials = new NetworkCredential("user", "pass");
WebRequest.DefaultWebProxy = wproxy;
WebProxy wproxy=新的WebProxy(“新代理”,true);
Credentials=newnetworkcredential(“用户”、“通过”);
WebRequest.DefaultWebProxy=wproxy;
代理设置可能会出现此错误。
请使用web浏览器检查代理设置。只需将连接设置选项->设置->连接设置更改为自动检测代理设置
祝你好运…行“ws=新服务客户端(customBinding,endpoint)”引用一个类System.ServiceModel.ClientBase。我找不到对象/属性WebRequest.DefaultWebProxy我不知道的是WebRequest是一个静态类。你真的需要做的不仅仅是发布一堆代码和错误消息。跟我们谈谈。你说你已经尝试了很多事情,那么,你尝试了什么?你有什么尝试你认为这没有帮助吗?你到底想做什么却不起作用?错误实际上发生在哪一行?它总是发生,还是只是偶尔发生?如果有时发生,你知道什么时候会发生?错误发生在“ws.emitterboleto(“test”)”行。无论你看到哪里,提示都是使用“binding.UseDefaultWebProxy=true“,但无论是否使用此选项,错误都是相同的。如果我在没有代理的计算机上运行,工作正常,但当我在internet explorer中设置代理时,开始出现此错误。我希望我已经更清楚了。您应该将所有信息编辑到实际问题中,而不是将其作为注释。