The remote server returned an unexpected response: (400) Bad Request

problem:

cs client calls the c # webservce Times "The remote server returned an unexpected response: (400) Bad Request" error, error tracking information is as follows:

Server stack trace: 
   在 System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory`1 factory, WebException responseException, ChannelBinding channelBinding)
   在 System.ServiceModel.Channels.HttpChannelFactory`1.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.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   在 TotalProduceLineSys.ServiceReference2.WebService1Soap.UploadData(String guid, DataEntity[] li_dataEntity)
   在 TotalProduceLineSys.ServiceReference2.WebService1SoapClient.UploadData(String guid, DataEntity[] li_dataEntity) 

 

 

solution:

Has not been a problem before this webservice, this is the first reported this wrong. Internet to find information and some say that too much data is out of range, so the end webservice cs modify the configuration file will turn up the parameters, see the problem still exists. In addition, some say that uploaded data contains special characters. I try to debug locally and found the existence of "\ 0" such special characters. Later find the data source will dispose of this particular character and then upload everything is normal.

Guess you like

Origin blog.csdn.net/taoerchun/article/details/90714273