简体   繁体   中英

Javascript client fails to connect to SignalR end point

Dear Programming Gurus,

I am working of signalr project using .NET CORE on the backend and ReactJS on the front end. It works on my local machine, but when i tried them on development server somehow the font end site giving me an issue. If you look at the first picture, we can see the signalr end point response perfectly via https on the web browser.

在此处输入图像描述

But when the front end script try to connect it gives connection error as shown below. It seems the client script instead of use https, it uses wss.

在此处输入图像描述

The client code is simple.

在此处输入图像描述

I just wondering what else need to be checked to ensure the client wss can find the endpoint and start working.

Any help will be appreciated.

At last, i found the answer by my self. My gut feeling leads to the setup on windows server setup to enable the web socket protocol.

This is what i did to solve the issues:

(1) On my server, windows start, i typed Server Manager

在此处输入图像描述

(2) Then i select (2) Add Roles and features.

在此处输入图像描述

(3) A pop up window will appear, click next

在此处输入图像描述

(4) Click Next

在此处输入图像描述

(5) On "Select server roles", expand Web Server (IIS) . Expand the next Web Server check box again, then expand Application Development . Now, make sure you check the check box for WebSocket Protocol . Then click next.

在此处输入图像描述

(6) Click Next and then click Install .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM