Application_Start()在IIS7.5中调用两次托管的MVC 5应用程序 [英] Application_Start() called twice in IIS7.5 hosted MVC 5 application

查看:124
本文介绍了Application_Start()在IIS7.5中调用两次托管的MVC 5应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将我的所有解决方案移到新安装的计算机上后(这让我觉得这是一个配置问题),我现在遇到了我的MVC 5 Web应用程序的这个问题。

After moving all my solutions over to a newly installed machine (which makes me think this is a config issue), I am now having this problem with my MVC 5 web application(s).

当我构建我的Web应用程序(VS 2013)时,这当然会重新生成所有Web代码,IIS将在下一页加载时重新启动应用程序。但是现在看来,当我进入我的开始/登录页面时,Application_Start()会按预期触发,但是当提交页面时,在到达HttpPost方法之前,整个应用程序似乎再次启动(Application_Start再次运行)。第二次启动似乎发生在调用第一个Application_End()之前......但不管顺序如何,我都不知道为什么现在这个问题。

When I build my web application (VS 2013), this of course regenerates all the web code and IIS will restart the application on next page load. However now it seems, when I go to my start/login page, the Application_Start() fires as expected, but when the page is submitted, before the HttpPost method is reached, the entire application seems to start again (Application_Start runs again). This second start seems to occur before the first Application_End() is called...but regardless of the sequence I have no idea why this is now an issue.

在Application_End()中检查应用程序关闭原因我得到了臭名昭着的模糊(显然完全未记录)BuildManagerChange...... MSDN给出了一些荒谬的含糊描述。

Checking the application shutdown reason in Application_End() I get the notorious vague (and apparently completely undocumented) "BuildManagerChange"...which MSDN gives some ridiculously vague description of.

有没有人知道为什么在将我的开发环境加载到新机器上之后会出现这种情况。两台机器都是运行IIS7.5的Win7 Pro,我相信IIS配置与旧配置相同(但显然不是??)。源代码/ web.config / etc在机器之间没有改变。

Does anybody have idea why this would start after loading my development environment onto a new machine. Both machines are Win7 Pro running IIS7.5, and I believe the IIS config is identical to the old one (though, apparently not??). The source code/web.config/etc has not changed between machines.

我在这个问题上找到的唯一文件是关于使用IISExpress,但我使用的是与Win7 pro一起安装的标准IIS7.5。

The only documentation I could find on this issue was in regards to using IISExpress, however I am using the standard IIS7.5 installed with Win7 pro.

编辑:从网站的整个启动中删除所有自定义代码,并将我的LoginController恢复为原始的简单形式(没有自定义代码),这仍然会发生。

After removing all custom code from the entire startup of the site, and reverting my LoginController back to it's original simple form (no custom code), this still occurs.

推荐答案

嗯,浪费2天这很有趣!但是,这已经解决了。运行procmon显示mcshield.exe(McAfee AV)正在访问hash.web。显然,实时访问扫描程序检查asp.net缓存,并以某种方式IIS意识到这一点,并认为它需要再次重建该站点。出于某种原因,迈克菲在第一次之后没有检查它,因此它在第二次构建/重启后正常运行。我在c:\ Windows \ Microoft.NET文件夹中添加了扫描程序排除,这似乎解决了这个问题。 -

Well, wasting 2 days on this was fun! But, this was resolved. Running procmon showed that hash.web was being accessed by mcshield.exe (McAfee AV). Apparently the live "on access scanner" checks the asp.net cache, and somehow IIS is aware of this and thinks it needs to rebuild the site again. For some reason McAfee does not check it after this first time so it functions normally after a second build/restart. I added a scanner exclusion to the c:\Windows\Microsoft.NET folder, and that seems to have solved the issue. –

这篇关于Application_Start()在IIS7.5中调用两次托管的MVC 5应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆