
在调用WCF服务时显示异常“服务器提交了协议违规.Section = ResponseStatusline”
请给出建议来解决这个问题/任何其他替代解决方案
//Code for creating proxypublic 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";} 服务器堆栈跟踪:
at System.ServiceModel.Channels.httpChannelUtilitIEs.ProcessGetResponseWebException(WebException webException,httpWebRequest request,httpAbortReason abortReason)
at ServiceModel.Channels.httpChannelFactory.httpRequestChannel.httpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message,TimeSpan timeout)
at System.ServiceModel.dispatcher.RequestChannelBinder.Request(Message message,TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action,Boolean oneway,
ProxyOperationRuntime operation,Object[] ins,Object[] outs,Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
methodCall,ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)Exception rethrown at [0]:
at System.Runtime.Remoting.ProxIEs.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)
at System.Runtime.Remoting.ProxIEs.RealProxy.PrivateInvoke(MessageData&
msgData,Int32 type)
at DevicesService.IDevicesService.CheckNetworkConnection(String ipAddress)
我在app.config中的客户端代码
我在web.config中的服务器端代码
解决方法 我之前没有见过这个例外,但是我已经遇到了很大的问题需要以这种方式进行代理工作.我不知道为什么但是在BasichttpBinding中设置代理地址并使用默认代理为false从来没有对我有用.我总是必须使用默认Web代理并在那里设置URL或在http传输绑定元素中创建全新的自定义绑定和设置代理URL. 总结以上是内存溢出为你收集整理的c# – 具有Internet代理服务器的Windows WCF客户端显示错误服务器提交了协议违规.第= ResponseStatusLine全部内容,希望文章能够帮你解决c# – 具有Internet代理服务器的Windows WCF客户端显示错误服务器提交了协议违规.第= ResponseStatusLine所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)