c# - 获取常规 ConfigurationErrorsException

标签 c# azure visual-studio-2013 stackexchange.redis azure-redis-cache

我正在为我的 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/

相关文章:

javascript - Google Analytics Embed API 服务器端授权不使用 C# 呈现图表

c# - 如何使用 WPF 和 .NET 3.5 注册一个全局热键来说 CTRL+SHIFT+(LETTER)?

c# - 建立与 SQL Server 的连接时出现与网络相关或特定于实例的错误。服务器未找到或无法访问。

visual-studio-2013 - VS 2013 MVC项目中的Web.tt导致错误 "value does not fall within the expected range"

azure - 并行安装不同的 Azure 模拟器

c# - 设置边框样式模板,但允许灵活使用值

json - 在 Azure 中链接两个 ARM 模板的最佳方法是什么

iis - 如何在传输到存储之前过滤 Azure 中的 IIS 日志?

azure - 仅在 azure 的仪表板中显示值?

c++ - 如何消除mfc中的链接错误?