简体   繁体   English

Azure上的C#MVC应用程序:新部署时站点工作正常,但闲置后失败

[英]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.

相关问题 C# Azure Function App 部署时的行为不同 - C# Azure Function App behaves differently when deployed C# Azure ServiceBus / Azure SQL - 在本地工作,部署到 Azure 时似乎不起作用 - C# Azure ServiceBus / Azure SQL - works locally, does not seem to work when deployed to Azure Azure应用程序可在开发架构上运行,但在部署时无法运行 - Azure app works on dev fabric but not when deployed 具有Azure AD身份验证的MVC Webapp在本地运行良好,但在移植到Azure应用程序服务时无法正常运行 - MVC webapp with Azure AD authentication works fine in local but not when porting to Azure app services Twilio SMS 无法通过部署到 Web 服务器的 ASP.NET MVC C# web 工作(但在本地测试环境中工作正常) - Twilio SMS not working via ASP.NET MVC C# web deployed to Web Server (but works fine in local test environment) 在Azure中部署MVC应用程序RoleManager后出现问题 - MVC Application RoleManager issue after being deployed in Azure 将映像上传到Azure Blob存储-本地工作,部署后失败 - Uplod images to azure blob storage - Works locally, fails when deployed C#单元测试无法将图像保存到服务器,但应用程序正常运行 - C# Unit test fails on saving image to server but app works fine MVC 中的 OAuth 2.0 Mailkit“身份验证失败”,但 c# 控制台应用程序工作正常 - OAuth 2.0 Mailkit “Authentication failed” in MVC, but c# console-app works fine C#:从测试方法中调用时方法失败,但在其他情况下效果很好 - C#: Method fails when called from test method but works fine otherwise
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM