Error: The remote server returned an unexpected response: (400) Bad Request
-
Hi, I have WCF service inside ASP.NET Web application that is hosted on IIS 7. We're encoding and decoding some strings. Decoding works well, but when we try to encode some very long XML the following error comes up:
System.ServiceModel.ProtocolException was unhandled
Message=The remote server returned an unexpected response: (400) Bad Request.
Source=mscorlib
StackTrace:
Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding)
at System.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, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, 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 TestClient.ServiceReference.IUfoDecoderService.Encode(String xml)
at TestClient.ServiceReference.UfoDecoderServiceClient.Encode(String xml) in C:\gtk\Amphora\WCF\UfoDecoderWebApplication\TestClient\Service References\ServiceReference\Reference.cs:line 69
at TestClient.Form1.button2_Click(Object sender, EventArgs e) in C:\gtk\Amphora\WCF\UfoDecoderWebApplication\TestClient\Form1.cs:line 42
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)