c# – 具有Internet代理服务器的Windows WCF客户端显示错误服务
我们的团队尝试使用Internet代理服务器创建一个
Windows应用程序(c#)来调用WCF服务
在调用WCF服务时显示异常“服务器提交了协议违规.Section = ResponseStatusLine” 请给出建议来解决这个问题/任何其他替代解决方案 //Code for creating proxy public static DevicesServiceClient CreateProxy() { var proxy = new DevicesServiceClient("BasicHttpBinding_IDevicesService"); BasicHttpBinding binding = new BasicHttpBinding(); binding.Security.Mode = BasicHttpSecurityMode.None; binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None; binding.UseDefaultWebProxy = false; binding.ProxyAddress = new Uri(string.Format("http://{0}:{1}","192.168.0.20","808")); proxy.Endpoint.Binding = binding; proxy.ClientCredentials.UserName.UserName = "Username"; proxy.ClientCredentials.UserName.Password = "Password"; } 服务器堆栈跟踪:
我在app.config中的客户端代码 我在web.config中的服务器端代码 解决方法
我之前没有见过这个例外,但是我已经遇到了很大的问题需要以这种方式进行代理工作.我不知道为什么但是在BasicHttpBinding中设置代理地址并使用默认代理为false从来没有对我有用.我总是必须使用默认Web代理并在那里设置URL或在http传输绑定元素中创建全新的自定义绑定和设置代理URL.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |