获取WebSocket错误:使用文件时出现网络错误12030。使用信号器复制

获取WebSocket错误:使用文件时出现网络错误12030。使用信号器复制,websocket,signalr,system.io.file,Websocket,Signalr,System.io.file,我下载了解决方案。它模拟服务器上长时间运行的进程,使用信号器不断更新客户端。在我将文件.Copy(source,destination,true)添加到控制器中的方法之前,它在IISExpress上工作得非常好(见下文) 当我选中jQuery.signalr-2.2.1.js时,当引发onclose事件时,错误代码为1000 我还就这一问题提出了一个问题。如果你能提出任何方法找出发生这种情况的地点/原因,我将不胜感激 更多信息: 它发生在IE浏览器和谷歌浏览器上,就像我一样 测试 我正在Vis

我下载了解决方案。它模拟服务器上长时间运行的进程,使用信号器不断更新客户端。在我将
文件.Copy(source,destination,true)
添加到控制器中的方法之前,它在IISExpress上工作得非常好(见下文)

当我选中jQuery.signalr-2.2.1.js时,当引发onclose事件时,错误代码为1000

我还就这一问题提出了一个问题。如果你能提出任何方法找出发生这种情况的地点/原因,我将不胜感激

更多信息:

  • 它发生在IE浏览器和谷歌浏览器上,就像我一样 测试
  • 我正在Visual Studio上使用SignalR 2.2.1和.NET Framework 4.5.2 2015年,但我也尝试了不同的信号器版本(2.0.2)

    • 我终于找到了解决问题的方法。我试图在Bin文件夹中进行更改,请点击此处:

      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);
      
      导致IIS回收应用程序域,因此,信号器连接重置并引发WebSocketException。因此,将第一行更改为:

      string directory = Server.MapPath("~/") + @"\";
      
      解决了我的问题

      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.
      
      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);
      
      string directory = Server.MapPath("~/") + @"\";