我有一个带有一个 Web 角色的 Azure 云项目。Web 角色端点在部署后几乎立即返回 HTTP 400 - 错误请求。当我检查跟踪消息日志时,我看到以下异常 -
Type : System.InvalidOperationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : Custom counters file view is out of memory.
Source : System
Help link :
Data : System.Collections.ListDictionaryInternal
TargetSite : Int32 CalculateMemory(Int32, Int32, Int32 ByRef)
HResult : -2146233079
Stack Trace : at System.Diagnostics.SharedPerformanceCounter.CalculateMemory(Int32 oldOffset, Int32 totalSize, Int32& alignmentAdjustment)
at System.Diagnostics.SharedPerformanceCounter.CreateCategory(CategoryEntry* lastCategoryPointer, Int32 instanceNameHashCode, String instanceName, PerformanceCounterInstanceLifetime lifetime)
at System.Diagnostics.SharedPerformanceCounter.GetCounter(String counterName, String instanceName, Boolean enableReuse, PerformanceCounterInstanceLifetime lifetime)
at System.Diagnostics.SharedPerformanceCounter..ctor(String catName, String counterName, String instanceName, PerformanceCounterInstanceLifetime lifetime)
at System.Diagnostics.PerformanceCounter.InitializeImpl()
at System.Diagnostics.PerformanceCounter..ctor(String categoryName, String counterName, String instanceName, Boolean readOnly)
似乎是当 .NET 达到允许分配给性能计数器的内存量上限时引起的。
因此,我尝试在我的 Web.config 中使用以下条目来增加内存分配 -
<configuration>
<system.diagnostics>
<performanceCounters filemappingsize="33554432" />
</system.diagnostics>
</configuration>
但即便如此,我仍然遇到了问题。有人可以为我提供一些解决问题的指示吗?
谢谢!