简体   繁体   English

如果在一定时间间隔内没有任何操作,Microsoft Azure App Service(MVC C#Web API)将进入睡眠状态

[英]Microsoft azure app service(MVC C# Web API) getting sleep if there is no action in some interval time

We have use Microsoft Azure shared web api hosting, but it getting sleep if there is no actions in that api(no api call from mobile app in some interval time), 我们已经使用了Microsoft Azure共享网络api托管,但是如果该api中没有任何操作(在一段时间间隔内没有来自移动应用的api调用),它将进入睡眠状态,

Once it getting sleep then it will take long time for give the response. 一旦入睡,将需要很长时间做出响应。

usually one api is give response in 125 milliseconds but long time no action in between the api and mobile app it will getting sleep, that time the same api take 2 minutes for give response or give the timeout exception. 通常一个API会在125毫秒内做出响应,但是很长一段时间之后,该api和移动应用之间都没有任何动作,它会进入睡眠状态,而同一个api则需要2分钟才能做出响应或给出超时异常。

App engine running in Share hosting model 以共享托管模式运行的App引擎

How to resolve that, Please help me. 如何解决该问题,请帮助我。

This is 'by design' for the Shared App Service. 这是共享应用程序服务的“设计使然”。 If you want to use Always on, move to Basic (or higher) tier. 如果要使用始终启用,请移至基本(或更高)层。

Always On. 永远在线。
By default, web apps are unloaded if they are idle for some period of time. 默认情况下,如果Web应用程序闲置了一段时间,则会将其卸载。 This lets the system conserve resources. 这样可以节省系统资源。 In Basic or Standard mode, you can enable Always On to keep the app loaded all the time. 在“基本”或“标准”模式下,可以启用“始终打开”以始终保持应用程序加载。 If your app runs continuous WebJobs or runs WebJobs triggered using a CRON expression, you should enable Always On, or the web jobs may not run reliably. 如果您的应用程序运行连续WebJobs或运行使用CRON表达式触发的WebJobs,则应启用Always On,否则Web作业可能无法可靠运行。

Source: Configure web apps in Azure App Service 来源: 在Azure App Service中配置Web应用程序

This is standard behavior for Shared pricing tiers. 这是共享定价层的标准行为。 If you want your app to keep alive you need Always on enabled which is available starting from Basic pricing. 如果您希望您的应用保持运行状态,则需要启用“ 始终启用”功能,该功能可从基本定价开始使用。 Otherwise app pool will be always recycled after some period of inactivity (about 21 minutes). 否则,闲置一段时间(约21分钟)后,应用程序池将始终被回收。

If your application uses Application Insights , you could configure a ping test to ensure your API stays warm (the Always On feature basically does the same). 如果您的应用程序使用Application Insights ,则可以配置ping测试以确保您的API保持热状态(“始终开启”功能基本上是相同的)。 Alternative you could use Azure Scheduler to invoke your API periodically. 或者,您可以使用Azure Scheduler定期调用您的API。


声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C#MVC Web应用程序服务连接到Azure存储Blob - C# MVC Web App Service Connect to Azure Storage Blob 使用C#Web API的Microsoft Azure身份验证 - Microsoft Azure authentication with c# web api Windows 服务(客户端)正在与 C# Web ZDB974238714CA8DE634A7CE1D083A14Z 通信。 我想在某个时间间隔检查服务器是否在线 - Windows service (Client) is communicating with C# Web API (Server). I want to check the server is online or not at a time interval 我们可以从 c# 重新启动 Microsoft Azure 应用服务吗? - Can we restart Microsoft Azure app service from c#? Microsoft Azure上的C#MVC LocalResource - C# MVC LocalResource on Microsoft Azure 将URL参数获取到C#MVC应用程序的ServiceInterface服务中 - Getting a URL parameter into the ServiceInterface Service of a C# MVC app 使用MVC上传文件而不使用带有C#的第三个parry API时,如何在Azure App Service中扫描病毒? - How can I scan for virus in Azure App Service when uploading a file using MVC not using a third pary API with C#? 我的C#MVC Web应用程序API的URI是什么? - What is my C# MVC Web app api's URI? 如何在C#/ MVC中缓存Web服务结果,而不是一直调用Web服务 - How to cache web service results in C# / MVC instead of calling web service all the time Microsoft Azure C# API 的替代方案 - Alternative for the Microsoft Azure C# API
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM