- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我目前正在 Ubuntu 上运行 apache2 网络服务器。此 Web 服务器托管 Vue.js Web 应用程序,该应用程序使用 SignalR 连接到 .Net Core 应用程序(也在同一 linux 服务器上)以创建 websocket。
.Net Core 应用程序使用 Kestrel 运行。以下是将 domain.com/api 重新路由到在端口 5000 上运行的 .Net Core 应用程序的 apache 配置。
<VirtualHost *:80>
ServerName example.com
Redirect permanent / https://www.example.com/
</VirtualHost>
<VirtualHost _default_:443>
DocumentRoot /var/www/example.com/dist/spa
ServerName www.example.com
ServerAlias example.com
ProxyPreserveHost On
ProxyPass "/api" http://localhost:5000/
ProxyPassReverse "/api" http://localhost:5000/
RewriteEngine on
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
RewriteRule /(.*) ws://localhost:5000/$1 [P]
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:!RC4+RSA:+HIGH:+MEDIUM:!LOW:!RC4
SSLCertificateFile /etc/apache2/ssl/example_com.crt
SSLCertificateKeyFile /etc/apache2/ssl/server.key
SSLCertificateChainFile /etc/apache2/ssl/example_com.ca-bundle
ErrorLog ${APACHE_LOG_DIR}example-error.log
CustomLog ${APACHE_LOG_DIR}example.log common
</VirtualHost>
Failed to complete negotiation with the server: SyntaxError: Unexpected token H in JSON at position 0
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1] Request starting HTTP/1.1 POST http://example.com//mainHub/negotiate text/plain;charset=UTF-8 0
/
在 localhost:5000 的末尾 - 这允许外部连接到达正确的 API 路径。
<VirtualHost *:80>
ServerName example.com
Redirect permanent / https://www.example.com/
</VirtualHost>
<VirtualHost _default_:443>
DocumentRoot /var/www/example.com/dist/spa
ServerName www.example.com
ServerAlias example.com
RewriteEngine on
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteRule /(.*) wss://localhost:5000$1 [P]
RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
RewriteRule /(.*) https://localhost:5000$1 [P]
ProxyPreserveHost On
ProxyPass "/api" http://localhost:5000
ProxyPassReverse "/api" http://localhost:5000
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:!RC4+RSA:+HIGH:+MEDIUM:!LOW:!RC4
SSLCertificateFile /etc/apache2/ssl/example_com.crt
SSLCertificateKeyFile /etc/apache2/ssl/server.key
SSLCertificateChainFile /etc/apache2/ssl/example_com.ca-bundle
ErrorLog ${APACHE_LOG_DIR}example-error.log
CustomLog ${APACHE_LOG_DIR}example.log common
</VirtualHost>
WebSocket connection to 'wss://example.com/api/mainHub?id=k1-_KxspgAQgIAhKroQBpQ' failed: Error during WebSocket handshake: Unexpected response code: 502
Error: Failed to start the transport 'WebSockets': null
最佳答案
如果您的 .Net Core 应用程序正在收听 /api/
在端口 5000 上,然后将其添加到 ProxyPass 指令中:
ProxyPass "/api" http://localhost:5000/api
ProxyPassReverse "/api" http://localhost:5000/api
RewriteEngine on
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
RewriteRule /(.*) ws://localhost:5000/$1 [P]
ProxyPreserveHost On
ProxyPass "/api" http://localhost:5000
ProxyPassReverse "/api" http://localhost:5000
关于apache - "Unexpected token H in JSON at position 0"Apache Web 服务器上的 SignalR 核心和 Kestrel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57551748/
我想知道如何存储在调用时可以触发到连接的客户端的变量服务器端? 我使用并发字典来跟踪连接 GUID 并想知道我是否可以在服务器上存储字符串或其他数据类型,例如最后 10 条消息,因此当出现新连接时,客
无法让 SignalR 在我的机器上工作(使用 IE9)。在输入一些文本并单击提交时,文本未按预期列出。另外,我希望从多个浏览器实例更新列表,但它不会发生。没有错误。有人可以帮忙吗? C# names
找到后this update围绕与组的通信,似乎一个组与集线器名称无关。如果这是正确的(如果我弄错了,请告诉我)集线器有什么方法可以访问另一个集线器的组,或者更好地拥有某种全局组? 我的问题是我有一个
抽象的 嗨,我在考虑是否可以使用 SignalR 发送消息。假设客户端断开连接,但最终在很短的时间内(例如 3 秒)重新连接。客户端会在断开连接时收到所有发送给他的消息吗? 例如,让我们考虑 Long
我正在为中等负载的 Web 应用程序评估 SignalR。 我们期望大约 500 条消息/秒,这对 SignalR 来说应该不是问题。 但是,我们担心此解决方案的可靠性。我们的环境有一个有问题的网络,
我有以下JS工作: var chat = $.connection.appHub; 我的应用程序有一个单一的中心AppHub,它处理两种类型的通知-Chat和Other。我使用一个集线器,因为我需要一
我升级到.NET 4.5,现在SignalR似乎坚持要在Firefox / Chrome中使用WebSockets-即使我只是在没有WebSocket Server的Windows 7上使用。 该请求
您能否在服务器端辨别给定的SignalR连接使用哪种传输方法? (WebSocket,SSE,长时间轮询等?) 最佳答案 在集线器内部,您可以通过查看请求的查询字符串来检测正在使用的传输: Conte
我在MVC4应用程序中使用Visual Studio 2012 Ultimate RC,SignalR 0.5.1和Jquery 1.7.2。 我看过:MVC4 SignalR "signalr/hu
假设我的网络连接中断了几秒钟,并且我错过了一些 SignalR 服务器推送的消息。 当我重新获得网络连接时,我错过的消息是否会丢失?或者当我重新连接时 signalR 会处理它们并将它们推出吗? 如果
如果我有一个 signalR 集线器,它向所有具有相当大的有效负载或私有(private)信息的客户端发送消息,那么所有连接到该集线器的客户端(同一组的一部分)是否都会收到消息,即使它们没有订阅客户端
如果我有一个 signalR 集线器,它向所有具有相当大的有效负载或私有(private)信息的客户端发送消息,那么所有连接到该集线器的客户端(同一组的一部分)是否都会收到消息,即使它们没有订阅客户端
谁能让我知道 SignalR 内部是如何以高级方式工作的? 我猜测它正在使用 Response.Flush 刷新数据,并且在客户端以一定的时间间隔发送 Ajax 请求。正确吗? 最佳答案 不,Sign
我正在使用 Microsoft SignalR 向浏览器推送通知。这些通知是由其他浏览器的操作触发的。我想做一个有时发送通知的后台任务。例如,在 12:45:21,我想向所有连接的用户发出通知,即使他
我的 SignalR 存在以下问题,用户从移动设备访问我的网站。 问题在于,当手机锁定或用户转到另一个应用程序时,会在服务器上触发 Disconnect() 方法(我尝试向服务器发送消息并等待它通过
如果我使用 SignalR 发送消息,客户端是否可能收不到消息?您如何验证通信中是否出现任何错误?我想在发送服务器通知后将消息发送回服务器,但有没有更好的方法? 最佳答案 是的,客户端可能没有收到消息
Web 服务器如何使用 SignalR 同步调用客户端上的方法?这里的关键部分是服务器应该等待客户端将数据发送回服务器才能继续? 基本上,我希望将客户端方法调用视为 WCF 服务请求。调用客户端并等待
我正在尝试调试 SignalR 连接问题,虽然我知道如何启用客户端日志记录,但我不知道如何启用服务器端日志记录。它似乎没有将任何内容记录到控制台。 我试过在 HubConfiguration 中使用
如果 SignalR 服务器的内部缓冲区溢出,则它似乎可以在将消息发送到客户端之前丢弃消息(请参阅 https://github.com/SignalR/SignalR/issues/2075 )。目
我在 Blazor 服务器端应用程序中使用 SignalR。我将 Microsoft.AspNetCore.SignalR.Client Nuget 包 (v5.0.11) 添加到项目中,并使用以下代
我是一名优秀的程序员,十分优秀!