1

Currently trying to implement SignalR in my ASP.NET MVC application. When I specify that I want it to use web sockets in the client as shown below:

 $.connection.hub.start({ transport: ['webSockets'] })
        .then(init)
        .then(function() {
            console.log('Hub Started Successfully!');
        });

I get an error saying that web sockets are not supported and I need to add the following line to my config file:

<httpRuntime targetFramework="4.5.1" />

Here's the exact error:

 WebSockets is unsupported in the current application configuration. To
 enable this, set the following configuration switch in Web.config:
 <system.web>  
    <httpRuntime targetFramework="4.5" /> 
 </system.web>

When I do, my async await for partial views stops working and I get the following error:

InvalidOperationException: HttpServerUtility.Execute blocked while waiting for an asynchronous operation to complete.

This error doesn't happen when I remove the runtime target framework line from the config file.

The ASP.NET MVC project runs on .NET 4.7.1 framework and the server / local dev machine has a runtime of 4.0 installed on it.

Any help would be greatly appreciated. Thank you in advance!

Hytham
  • 11
  • 2
  • "I get an error saying that web sockets are not supported", so what error? No error today requires you to go back to 4.5.1. – Lex Li Apr 21 '22 at 20:21
  • WebSockets is unsupported in the current application configuration. To enable this, set the following configuration switch in Web.config: – Hytham Apr 21 '22 at 20:32
  • Would you mind check your IIS installed modules first? https://stackoverflow.com/a/26994345/11182 When your web app runs on .NET Framework 4.7.1 you shouldn't have any `httpRuntime` tag to downgrade. – Lex Li Apr 21 '22 at 22:45
  • I already have Web Sockets installed. It also says in the post that you linked that the user still had to include the code below: ` ` – Hytham May 10 '22 at 21:01

0 Answers0