代码之家  ›  专栏  ›  技术社区  ›  Matthew Rathbone

ASP.NETMVC在执行一些web请求/响应任务后返回View()时挂起

  •  2
  • Matthew Rathbone  · 技术社区  · 15 年前

    我有一个名为UpdateSite()的控制器操作,浏览这个操作是我启动(通常是自动的)数据收集过程的一种手动方式。

    1. 使用webapi执行几个web数据请求
    2. (可选)将一些数据发送回API,让它知道我刚刚做了什么。

    public ActionResult UpdateSite(string key)
            {
                if(key == KEY)
                {
                    log4net.Config.XmlConfigurator.Configure();
                    ILog log = LogManager.GetLogger("Default");
                    string tUserName = ConfigurationManager.AppSettings["UName"];
                    string tPassword = ConfigurationManager.AppSettings["UPassword"];
    
                    ApiService apiSvc = new ApiService(tUserName, tPassword, new InterpreterFactory(),
                                                                        log);
                    ControlPanel controller = new ControlPanel(Service, apiSvc, new DefaultAppStatusService(), log);
    
                    CaptureResults results = controller.Capture();
                    controller.EnrichData(results, new EnrichmentFactory(log));
    
                    var newData = controller.PersistData(results);
                    controller.ReplyWithNewData(newData);
                }
                return View();
            }
    

    所有这些似乎都运行良好,它完成了自己的工作,从外部API中提取所需的数据并将其写入数据库等。

    问题是,在“return View()”上,页面在浏览器中没有完全加载,站点永久挂起,迫使我重新启动dev服务器。这一页上只有一点文字。

    我完全不知道发生了什么事。还有人遇到过这样的事情吗?有什么想法吗?

    1 回复  |  直到 15 年前
        1
  •  0
  •   Andrei Rînea    15 年前

    此过程是否会更改bin文件夹或其任何子文件夹中的某个文件?如果是这样,它将回收应用程序池,请求将“崩溃”,没有机会。