Answered question

How to prevent error "Didn't switch protocols"?

I have an asp.net/Razor app that I like to perform a load test on, but NeoLoad reports the error "java.util.concurrent.ExecutionException: org.eclipse.jetty.websocket.api.UpgradeException: Didn't switch protocols, expected status <101>, but got <404>"

As far as I can tell, NeoLoad is not able to upgrade the connection to WebSockets. When I inspect network traffic in the Web Developer Toolbar of Firefox, I see traffic via WebSockets, so it appears as if the server/app side is working properly and the problem lies with NeoLoad.

When I let NeoLoad analyse the response to identify dynamic data, it does not find any dynamic data (suggested solution in a similar question).

Any suggestions on how to prevent this error message would be highly appreciated.

Thanks, Kurt

Kurt P.
Kurt P.

Kurt P.

Level
0
32 / 100
points
Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

Do you say that this id is not coming from any server responses? If you use the Flags request feature in NeoLoad and use the fourth option which is to search on server responses NeoLoad is not able to find this id "Zj33ZdsnbNUuGQ0oi40OA"?

If not then this id may be generated through a Javascript. You may search on the recorded JS if you can find the function that is generating it.

Did you find this useful ?

No (0)

Yes (0)

0% of users found this answer useful

Other answers

Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

The server sent back an HTTP 404 instead of an HTTP 101 for the switching protocol. So you should check if the URL does not contain any dynamic content or any other parameters.

If you make another recording and compare the WebSocket URL's on both recording do you see any differences especially on thet URL's?

Kurt P.
Kurt P.

Kurt P.

Level
0
32 / 100
points

Hi Nouredine, thanks for your quick answer.

Yes, the WebSocket URL's is different if I take the recording twice. The GET looks like
https://myURL/_blazor?id=JZj33ZdsnbNUuGQ0oi40OA
where the id is different for the different recordings.

NeoLoad does not find anything when I let it search for dynamic parameters.

Unfortunately, the id is nothing that I control, it appears behind the scenes by asp.net/Blazor, so I would not know how to deal with that.

Kurt P.
Kurt P.

Kurt P.

Level
0
32 / 100
points

"Do you say that this id is not coming from any server responses?" I guess I do say that, yes.

When I record a new user path, in the first websocket_channel action I find the id 'Gj6tNTPQEFC2SO8XhSypmg'. If I check this user path and search the id in the server response as you suggested, it does not pop up. Recording a new user path also creates a new id.

I do see a request for blazor.server.js, maybe this is creating the id and storing in a cookie, but this is only a wild guess. And it does not help me further.

My App uses standard Razor Pages with Blazor, which uses SignalR, not sure this info is useful.

Neil W.
Neil W.

Neil W.

Level
4
5000 / 5000
points
Team

Hi, if you are an existing customer or prospect, you should be able to engage your account team, they will be able to organise web meeting and give you some guidence on correlation

Kurt P.
Kurt P.

Kurt P.

Level
0
32 / 100
points

Thanks for your help, without it, I would have never found the solution, although it is a somewhat beginners mistake. The problem was, that the id from the recording was hard-coded into the check path. But a double click on the id allowed me to select the connectionId that was automatically extracted by NeoLoad from a previous response, and now the WebSocket upgrade can be done.

When I tried to flag the id as you suggested it was not there because the connectionid is set by the javascript, hence it is always different.

Thanks for your help.