我正在为我的 MVC 应用程序使用 Stackexchange redis,并且我经常收到如下所示的 w3wp 异常。它不会在生产中发生,所以我想知道这是否与 Visual studio 有关?
使用: Visual Studio 高级版 2013 版本:12.0.31101.00更新4
我正在使用ASP.NET session state provider由 Microsoft 提供,在我的 web.config 中它是这样的:(我指的是 azure redis)
<system.web>
<sessionState mode="Custom" customProvider="MySessionStateStore">
<providers>
<add name="MySessionStateStore"
type="Microsoft.Web.Redis.RedisSessionStateProvider"
host="***"
accessKey="***"
ssl="true" />
</providers>
</sessionState>
</system.web>
当我打开应用程序时,每隔几分钟就会出现此异常。
Application: w3wp.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception.
Exception Info: System.Configuration.ConfigurationErrorsException
Stack: at System.Diagnostics.TraceUtils.GetRuntimeObject(System.String, System.Type, System.String)
at System.Diagnostics.TypedElement.BaseGetRuntimeObject()
at System.Diagnostics.ListenerElement.GetRuntimeObject()
at System.Diagnostics.ListenerElementsCollection.GetRuntimeObject()
at System.Diagnostics.TraceInternal.get_Listeners()
at System.Diagnostics.TraceInternal.WriteLine(System.Object)
at StackExchange.Redis.SocketManager.Read()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart(System.Object)
最佳答案
从异常来看,它似乎不是来自 session 状态提供程序。问题是由于其他原因造成的。如果异常是由于 RedisSessionStateProvider 引起的,那么您会在异常中看到类似“at Microsoft.Web.Redis.RedisSessionStateProvider*****”的内容。
您可以通过使用不同的 session 状态来验证这一点。就像尝试使用“InProc” session 状态提供程序一样,如果它仍然重现,则意味着其他问题存在问题,而不是 RedisSessionStateProvider。
如果您可以提供可以重现此问题的示例测试应用程序,请发送给我们 [email protected]然后我可以进一步调试它。
关于c# - 获取常规 ConfigurationErrorsException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28297005/