0
我下载了Sample SignalR Progress Bar解决方案。它模拟服务器上长时间运行的进程,持续更新客户端,使用SignalR。它在IISExpress完美工作,直到我在控制器中添加File.Copy(source, destination, true)
我的方法(见下文)。获取WebSocket错误:使用File.Copy与SignalR时出现网络错误12030
public JsonResult LongRunningProcess()
{
string directory = Server.MapPath("~/bin/") + @"\";
string source = directory + @"Templates\Template.xlsx";
string destination = directory + @"Spreadsheets\output file.xlsx";
System.IO.File.Copy(source, destination, true);
for (int i = 0; i <= 50; i++)
{
Thread.Sleep(500);
Functions.SendProgress("Process in progress...", i , 50);
}
return Json("", JsonRequestBehavior.AllowGet);
}
现在我收到服务器端的一个WebSocketException:在客户端
SignalR.Transports.WebSocketTransport Error: 0 : OnError(7bdc2904-8f12-4324-898f-58e4a9f4e686, System.Net.WebSockets.WebSocketException (0x800703E3): The I/O operation has been aborted because of either a thread exit or an application request
at System.Web.WebSockets.WebSocketPipe.<>c__DisplayClass9_0.<ReadFragmentAsync>b__0(Int32 hrError, Int32 cbIO, Boolean fUtf8Encoded, Boolean fFinalFragment, Boolean fClose)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.WebSockets.AspNetWebSocket.<DoWork>d__45`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.WebSockets.AspNetWebSocket.<>c__DisplayClass36_0.<<ReceiveAsyncImpl>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.SignalR.WebSockets.WebSocketMessageReader.<ReadMessageAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.SignalR.WebSockets.WebSocketHandler.<ProcessWebSocketRequestAsync>d__25.MoveNext())
和WebSocket的错误:
SCRIPT12030: WebSocket Error: Network Error 12030, The connection with the server was terminated abnormally
[time] SignalR: Unclean disconnect from websocket:
[time] SignalR: Closing the Websocket.
当我检查jQuery.signalr-2.2。 1.js,onclose事件引发,错误代码为。
我还在SignalR website上提出了一个问题。如果您能以任何方式找出发生这种情况的原因,我将不胜感激。
更多信息:
- 它发生在Internet Explorer以及谷歌浏览器,因为我 测试。
- 2015年,我在Visual Studio 上使用SignalR 2.2.1和.NET Framework 4.5.2,但我也尝试了不同的SignalR版本(2.0.2)。