SignalR:WebSocket 握手期间出错:意外响应代码:400 [英] SignalR: Error during WebSocket handshake: Unexpected response code: 400
问题描述
我刚刚开始使用 SignalR.我已经使用信号器在我的网站上实现了实时数据反射.尝试与网络套接字连接时,我在控制台上收到Web-Socket 握手期间出错:意外响应代码:400"错误.
I have just started working with SignalR. I have implemented real-time data reflection on my site using signalr. I was getting "Error during Web-Socket handshake: Unexpected response code: 400" error on console with when trying to connect with web-socket.
应用程序使用 Asp.net MVC - signalR 2.0.3 开发并托管在 Windows server 2012 - IIS 8 上
Application is developed with Asp.net MVC - signalR 2.0.3 and hosted On Windows server 2012 - IIS 8
它说我们需要网站指向 HTTPS(并使用 SSL)然后 http 才能使用 web-socket.我的问题也解决了.我的疑问是 - 我们不能在不使用 HTTPS 的情况下解决这个问题吗?因为每个网站可能不需要托管在 HTTPS(需要 SSL)上.
It says that We need website to point to HTTPS (and avail SSL) then http to work with web-socket. And my Issue resolved too. My doubt is - cant we solve this issue without using HTTPS ? As each website might not require to be hosted on HTTPS (which requires SSL).
推荐答案
在你的 web.config 文件中使用这个标签:
use this tag in your web.config file :
<httpRuntime maxRequestLength="40960" targetFramework="4.5" requestValidationMode="2.0" />
在
标签下.描述你的目标框架.错误会消失
under <system.web>
tag.
Describe your target framework.Error will be disappear
这篇关于SignalR:WebSocket 握手期间出错:意外响应代码:400的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!