Asp.Net Core 2 SignalR Ubuntu Xamarin Android [英] Asp.Net Core 2 SignalR Ubuntu Xamarin Android

查看:77
本文介绍了Asp.Net Core 2 SignalR Ubuntu Xamarin Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用nginx作为反向代理在ubuntu上部署了Asp.Net Core 2网站.该网站正常运行,但SignalR无效.在IIS-Express中本地可以进行相同的构建.在日志中出现以下错误, 通过发送204响应来终止长轮询连接.

I have deployed Asp.Net Core 2 website on ubuntu with Nginx as a reverse proxy. The website works but SignalR doesn't. Same build work locally in IIS-Express. Getting following error in logs, Terminating Long Polling connection by sending 204 response.

按照我正在使用的nginx配置,

Following nginx configuration I am using,

server {
    listen 80;
    location / {
        proxy_pass http://localhost:5000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection keep-alive;
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

我正在从Xamarin Android访问服务器. 可能是什么问题?任何帮助将是巨大的.预先感谢.

I am accessing the server from Xamarin Android. What can be the issue? Any help would be great. Thanks in advance.

推荐答案

您应更改配置以添加需要升级标头的其他路径

You should change you config to add additional path which needs the Upgrade header

server {
    listen 80;
    location / {
        proxy_pass http://localhost:5000;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }

    location /socket/path/ {
        proxy_pass http://localhost:5000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

这篇关于Asp.Net Core 2 SignalR Ubuntu Xamarin Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆