带有角前端的Signalr在Local主机上起作用,但没有远程工作
我有两个Azure Web应用程序服务:前端(在Angular上写)和后端(用SignalR编写)。他们俩都放在自己的服务器上,我正在尝试将前端连接到后端。以前,当我使用http
在Localhost上运行它时,一切都在本地工作,但是当我尝试在Azure上做完全相同的事情时我在Chrome中获得此错误:
我看到https
被'WSS'替换为'WSS',我猜这对SignalR来说不是很好(因为它应该落回到HTTPS /https如果WSS/WS不可用,正如其中一位评论者所说)。因此,显然我的前端看不到我的后端。
到目前为止,我尝试的是:
- 将协议更改为
http
,使用localhost
- 将后端设置为收听
0.0.0.0.0.0:5000
- 在Azure设置(在客户端和服务器上)打开Web插座,
我的问题是什么,如何将客户端连接到服务器端?谢谢。
I have two Azure Web App Services: front-end (written on Angular) and back-end (written in C# with SignalR). Either of them is placed on its own server, and I am trying to make front-end connect to back-end. Previously everything worked locally when I ran it on localhost, with http
, but when I try to do the exact same thing on Azure (I replaced localhost
with azure website domains), I get this error in Chrome:
I see that https
is replaced by 'wss', which I guess is not fine for SignalR (because it's supposed to fall back to https/https if wss/ws is unavailable, as one of the commenters stated). So apparently my front-end can't see my backend.
What I've tried so far:
- Changing protocols to
http
, the way it was withlocalhost
- Setting backend to listening to
0.0.0.0:5000
- Turning on Web Sockets in Azure settings (on both client and server)
What is my problem, and how do I connect my client side to the server side? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不应在应用程序服务上使用端口5000。配置您的应用程序,以便在部署时仅使用默认端口(有效端口80和443)。 WSS/SignalR在这些默认端口上正常工作。
您还可以查看暴露的列表端口。
You should not use port 5000 on App Service. Configure your app so that it only uses the default ports when deployed (effectively port 80 and 443). WSS/SignalR works fine over these default ports.
You can also see the list of exposed ports.