2017-10-10 165 views
0

我已经在ubuntu上将Asp.Net Core 2网站与Nginx一起部署为反向代理。该网站的作品,但SignalR没有。在IIS-Express中本地同样构建工作。在日志中获取跟踪错误, 通过发送204响应来终止长轮询连接。Asp.Net Core 2 SignalR Ubuntu Xamarin Android

继nginx的配置,我使用,

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服务器。 可能是什么问题?任何帮助都会很棒。提前致谢。

+0

尝试'proxy_set_header连接“升级”'; –

+0

谢谢。如果我这样做,我的POST-API不起作用。我会尽力而为。 –

+0

您可能需要它在一个特定的URL位置,而不是整个'/' –

回答

0

你应该改变你的配置要添加哪些需要升级头附加路径

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; 
    } 
}