"WebSocket升级请求失败"是什么? Web套接字上下文中的异常意味着什么? [英] What does "WebSocket upgrade request failed" exception mean in a context of Web sockets?
问题描述
当尝试在IIS 8 Express上将WCF与NetHttpBinding
一起使用时,客户端尝试连接时会在客户端抛出以下WebSocketException
:
WebSocket升级请求失败.收到响应状态码"200(OK)",预期为"101(SwitchingProtocols)".
Google搜索没有帮助. >
此错误可能是什么原因?
这表示HTTP服务器不支持该URL上的WebSocket.在WebSocket协商过程中,标准的HTTP 1.1 GET
请求通过特殊的Upgrade: websocket
标头发送到服务器,以使服务器知道客户端希望该连接使用WebSocket而不是HTTP.如果服务器支持WebSocket,并且请求标头有效,则要求服务器发送101
答复,以使客户端知道服务器在连接期间将连接切换到WebSocket.除3xx重定向以外的任何其他答复均意味着服务器无法识别或不允许该URL上的Upgrade
请求.
When trying to use WCF with NetHttpBinding
on IIS 8 Express, the following WebSocketException
is thrown on client side when the client attempts to connect:
WebSocket upgrade request failed. Received response status code '200 (OK)', expected: '101 (SwitchingProtocols)'.
Google Search is not helpful.
What could be the cause of this error?
It means the HTTP server does not support WebSockets on that URL. During a WebSocket negotiation, a standard HTTP 1.1 GET
request is sent to the server with a special Upgrade: websocket
header to let the server know that the client wants the connection to use a WebSocket and not HTTP. If the server supports WebSockets, and the request headers are valid, the server is required to send a 101
reply to let the client know that the server is switching the connection over to a WebSocket for the duration of the connection. Any other reply other than a 3xx redirect means means the server does not recognize or allow the Upgrade
request on that URL.
这篇关于"WebSocket升级请求失败"是什么? Web套接字上下文中的异常意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!