它可能與已知的Firefox-884693問題有關。基於某些研究(here和here)和searching通過SignalR代碼,修復將在發回響應之前分配Content-Type
。所以下面的文件可能不得不改變。
// src/Microsoft.AspNet.SignalR.Core/PersistentConnection.cs
private static Task FailResponse(IResponse response, string message, int statusCode = 400)
{
response.StatusCode = statusCode;
// response.ContentType = "text/plain"; // <--- ADD THIS LINE
return response.End(message);
}
// src/Microsoft.AspNet.SignalR.Core/Transports/WebSocketTransport.cs
private Task AcceptWebSocketRequest(Func<IWebSocket, Task> callback)
{
var accept = _context.Environment.Get<Action<IDictionary<string, object>, WebSocketFunc>>(OwinConstants.WebSocketAccept);
if (accept == null)
{
// Bad Request
_context.Response.StatusCode = 400;
// _context.Response.ContentType = "text/plain"; // <--- ADD THIS LINE
return _context.Response.End(Resources.Error_NotWebSocketRequest);
}
Action<IWebSocket> prepareWebSocket = socket => {
_socket = socket;
socket.OnClose = _closed;
socket.OnMessage = _message;
socket.OnError = _error;
};
var handler = new OwinWebSocketHandler(callback, prepareWebSocket, _maxIncomingMessageSize);
accept(null, handler.ProcessRequest);
return TaskAsyncHelper.Empty;
}
這將需要提交錯誤開源項目,分叉,應用更改,測試它,創造拉力要求等,它們是長項目比我有時間,現在。如果有人想測試這個理論,謝謝。