远程服务器返回了意外响应: (400) Bad Request

问题:

cs客户端调用c# webservce时报“远程服务器返回了意外响应: (400) Bad Request”错,错误跟踪信息如下:

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) 

 

 

解决方案:

这个webservice之前一直没有问题,这是第一次报这个错。网上找资料有的说是数据量太大超出了范围,故修改cs端webservice配置文件将相关参数调大了,发现问题依旧存在。另外有的说是上传的数据中包含特殊字符。我就尝试本地调试,发现确实存在“\0”这种特殊字符。后来找到数据源将这种特殊字符处理掉后再上传一切正常。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值