【Azure 应用服务】App Service下部署的应用报错 Out of Memory

问题描述

应用部署到App Service后,遇见了Out of Memory的错误。

 

报错信息:GetData  Error:, Exception of type 'System.OutOfMemoryException' was thrown.,

at System.IO.MemoryStream.set_Capacity(Int32 value)

at System.IO.MemoryStream.EnsureCapacity(Int32 value)

at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)

at OfficeOpenXml.Packaging.ZipPackage..ctor(Stream stream)

at OfficeOpenXml.ExcelPackage.ConstructNewFile(String password)

at OfficeOpenXml.ExcelPackage..ctor(FileInfo newFile)

at MyLife.Utility.ExcelHelper.LoadDataTableFromFile(String fileName)

at MyLife.Serivces.GetData()

 

2021-09-12 05:19:57.0362 | Error | HCPService-StartPreprocessing-Exception of type 'System.OutOfMemoryException' was thrown.-

2021-09-12 05:19:57.0756 | Error | An unhandled exception has occurred while executing the request. System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.

问题解决

面对部署后刚开始启动就出现OOM的错误情况,表示当前定价层的Memroy不足以满足应用的运行。但是App Service不同定价层的内存不同,最低的免费层的RAM为1G,最高可达到14G。

 (Source : https://www.azure.cn/pricing/details/app-service/) 

 

如果排除是定价层的内存限制外,还有一个重要的因素就是App Service的平台设置。

App Service支持32位,64位的平台系统。所以如果默认设置的位32位操作系统,那么它最大只支持4G的内存。为了让应用能使用最大的内存并不让APP Service的RAM资源浪费,当面临OOM的问题时,第一时间修改App Service的平台位数位64位。如果依旧出现OOM的情况,就可以考虑升级App Service的定价层。

 

[END]

 

posted @ 2021-10-12 17:36  路边两盏灯  阅读(196)  评论(0编辑  收藏  举报