Websocket for Blazor doesn't work with Openlitespeed on Centos

blinkor12 101 Reputation points

I have Openlitespeed installed on my CentOS server.

I deployed a Blazor app to the server after installing dotnet core. The Blazor code runs fine but I cannot get the Websocket to work.
If I look in console, I see that the Blazor application loads but the WebSocket cannot connect with no further error details.

I created this Blazor app by starting the blazor application on port 5000 and created an external app in OpenLiteSpeed as a web server. I then created a virtual host in OLS for my Blazor application.

If I go to the Virtual Host for my website, I can visit the website fine. However, if I look in console, I get an error that Blazor cannot establish a websocket connection to my domain. I tried adding port 80 to the 'Websockets' section of OLS but that made the website unable to load. I then added port 5000 to the websockets section but that didn't resolve the issue either and I received the same error.

If I run the application with Visual Studio on my local computer, the websocket connects fine. However, if I deploy the app to my remove CentOS server, it does not connect properly. My startup script for CentOS looks like this (assume I changed mywebsite.com):

Description=ASP.NET Blazor App

ExecStart=/usr/bin/dotnet /home/mywebsite.com/public_html/testapp.dll
# Restart service after 10 seconds if the dotnet service crashes:


How do I fix this?

A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,458 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 59,306 Reputation points
    0 comments No comments