在调用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";
}
服务器堆栈跟踪:
在System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException,HttpWebRequest request,HttpAbortReason abortReason)中
在ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)中
在System.ServiceModel.Channels.RequestChannel.Request(Message message,TimeSpan timeout)中
在System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message,TimeSpan timeout)中
在System.ServiceModel.Channels.ServiceChannel.Call(String action,Boolean oneway, ProxyOperationRuntime operation,Object [] ins,Object [] outs,TimeSpan timeout)中
在System.ServiceModel.Channels.ServiceChannel.Call(String action,Boolean oneway, ProxyOperationRuntime operation,Object [] ins,Object [] outs)中
在System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime operation)中
在System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)中异常在[0]处重新抛出:
在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)中
在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData,Int32 type)中
在DevicesService.IDevicesService.CheckNetworkConnection(String ipAddress)中
我的客户端代码在app.config中
我的服务器端代码在web.config中