[英]C# MVC app on Azure: Site works fine when freshly deployed but fails after being left idle
I have spent a good bit of time researching this but have not found anybody else reporting the issue that I am having. 我花了很多时间研究这个,但没有找到其他人报告我遇到的问题。
I deploy my site and everything is good. 我部署我的网站,一切都很好。 I share the link with my QA and UI peeps and everything works for them. 我与我的QA和UI窥视分享链接,一切都适合他们。 But if the site goes for a period of time, such as overnight, without being accessed then the web application is unable to start and reports "Method 'get_CurrentUser' in type ... does not have an implementation." 但是,如果网站持续一段时间,例如一夜之间,没有被访问,那么Web应用程序无法启动并报告类型中的“方法'get_CurrentUser'没有实现。” Stopping and restarting the site does not resolve the issue but if I simply re-upload the main .dll file (the exact same version of the .dll) to the site then everything works fine again. 停止并重新启动站点不能解决问题,但如果我只是将主.dll文件(完全相同的.dll版本)重新上传到该站点,那么一切正常。 For a while, at any rate. 无论如何,有一段时间。
Why would it be okay when newly published but fail after sitting for some time? 为什么新出版时会好起来却坐了一段时间后失败了? Any suggestions on troubleshooting this would be greatly appreciated. 任何有关解决此问题的建议将不胜感激。
IIS has introduced Suspend action for idle timeout, when site is idle for specified duration, IIS will suspend process, god knows what happens exactly but looks like it just hibernates the process. IIS已经为空闲超时引入了Suspend动作,当站点空闲指定的持续时间时,IIS将暂停进程,上帝知道究竟发生了什么,但看起来它只是休眠进程。 And waking up may not work, so you can change this action to terminate for idle timeout. 并且唤醒可能不起作用,因此您可以更改此操作以终止空闲超时。
Second option is to keep site awake by using pingdom or site24x7 services. 第二种选择是使用pingdom或site24x7服务保持站点清醒。
Could it help to try Azure Web App and set Always On? 尝试Azure Web App并设置Always On是否有帮助? http://azure.microsoft.com/updates/azure-web-sites-adds-always-on/ http://azure.microsoft.com/updates/azure-web-sites-adds-always-on/
It looks like I found a solution. 看起来我找到了一个解决方案。
The app start event in global.asax included "var assemblies = System.Web.Compilation.BuildManager.GetReferencedAssemblies();" global.asax中的app start事件包括“var assemblies = System.Web.Compilation.BuildManager.GetReferencedAssemblies();” in order to make sure that everything loads, but that line was -after- the call that was triggering all of the dependency registration. 为了确保所有内容都加载,但该行是在触发所有依赖项注册的调用之后。 I cut/pasted that line so that it happens first and the site came up fine when I tried it this morning. 我剪切/粘贴了那条线,以便它首先发生,并且当我今天早上尝试它时,网站很好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.