How to solve the errors Unable to connect to the remote server and The remote server returned an error: (400) Bad Request ?

Modified on Mon, 17 Feb at 3:13 PM

FIRST CREATED ON 17 Feb 2025  I  AUTHOR Emma Camacho

If getting the follow error every other time when rebuilding the cache of a Datasource or when running a task or in general, when using a Datasource, please review the version of Qlik Sense and upgrade accordingly.



Issue


WebSocketException: Unable to connect to the remote server
   at MailAndDeploy.Server.ExtensionMethods.Await(Task pTask, TimeSpan pTimeout)
   at MailAndDeploy.Server.Connectors.QlikSense.Rpc.RpcConnection.ConnectSocket()
   at MailAndDeploy.Server.Connectors.QlikSense.Rpc.RpcConnection..ctor(IRpcConnectionInitiator pInitiator, String pUrl, RpcHeader[] pHeaders, RpcCookie[] pCookies, RpcAuthenticationMethod pAuthenticationMethod, RpcConnectionResetSettings pResetSettings)
   at MailAndDeploy.Server.Connectors.QlikSense.QsConnection.CreateRpcConnection(String pUrl, RpcHeader[] pHeaders, RpcCookie[] pCookies, RpcConnectionResetSettings pResetSettings)
   at MailAndDeploy.Server.Connectors.QlikSense.QsConnection.OpenApp(String pAppId, String pEngineSessionId, Boolean pOpenWithoutData)
   at MailAndDeploy.Server.Connectors.QlikSense.QlikSenseAppConnector.FromDatasource(QlikSenseAppDatasource pDatasource, DatasourceImpersonationSettings pImpersonationSettings, Boolean pOpenWithoutData)
   at MailAndDeploy.Server.Execution.TaskExecutionContext.GetDatasourceConnector(Datasource pDatasource, DatasourceImpersonationSettings pImpersonationSettings, Boolean pOpenWithoutData)
   at MailAndDeploy.Server.Persistency.Entities.ImpersonateDatasourceConnectionAction.ExecuteAction()
   at MailAndDeploy.Server.Persistency.Entities.Action.Execute()
   at MailAndDeploy.Server.Persistency.Entities.Task.Execute(IEnumerable`1 pParameterValues)
WebException: The remote server returned an error: (400) Bad Request.
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Net.WebSockets.ClientWebSocket.d__21.MoveNext() 


Resolution


The problem you happens with the following patches:
August 2023 Patch 2
May 2023 Patch 6
February 2023 Patch 10
November 2022 Patch 12
August 2022 Patch 14
May 2022 Patch 16
February 2022 Patch 15
November 2021 Patch 17 

Please install a higher patch that solves the Qlik Sense issue QB-22217.



Looking for Additional Guidance?


If you require more detailed information or further assistance, please visit our comprehensive Online Documentation. Our resources are designed to help you navigate all features and functionalities effectively.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article