"The remote server returned an unexpected response: (400) Bad Request" is the error I am getting when I am trying to AddNewBatch from a Webservice
Here is the detailed stack trace:-
Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory`1 factory, WebException responseException, ChannelBinding channelBinding)
at System.ServiceModel.Channels.HttpChannelFactory`1.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.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 AB.FlexiCapture.FlexiCaptureWebServiceSoap.AddNewBatch(AddNewBatchRequest request)
at AB.FlexiCapture.FlexiCaptureWebServiceSoapClient.AB.FlexiCapture.FlexiCaptureWebServiceSoap.AddNewBatch(AddNewBatchRequest request) in C:\Users\abbyuser\source\repos\AB\AB\Connected Services\FlexiCapture\Reference.cs:line 7609
at AB.FlexiCapture.FlexiCaptureWebServiceSoapClient.AddNewBatch(Int32 sessionId, Int32 projectId, Batch batch, Int32 ownerId) in C:\Users\abbyuser\source\repos\AB\AB\Connected Services\FlexiCapture\Reference.cs:line 7619
at AB.Program.ProcessRecognition(FlexiCaptureWebServiceSoapClient service, Int32 userId, Int32 sessionId, Int32 projectId, String file) in C:\Users\abbyuser\source\repos\AB\AB\Program.cs:line 139
I am facing this issue when I running this in Webservice but when I run is from Standalone code(Console App) it is working fine.
Could anyone please help me on this.