单声道ASP.NET异常

时间:2012-11-16 15:31:10

标签: c# asp.net asp.net-mvc mono

有没有其他人在单声道ASP.NET上的xsp上运行此错误?我认为这与缓存有关,但是在Web.config文件中没有提到缓存,所以我没有故意改变任何东西。

这只会在正常运行几天后发生,并在服务器重新启动时自行修复。

Status Code: InternalServerError
Server Error in '/' Application
The given key was not present in the dictionary.

Description: HTTP 500. Error processing request.

Stack Trace:

System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
  at System.Collections.Generic.Dictionary`2[System.Collections.Generic.LinkedListNode`1[System.Web.Caching.CacheItem],System.String].get_Item (System.Collections.Generic.LinkedListNode`1 key) [0x00000] in <filename unknown>:0 
  at System.Web.Caching.CacheItemLRU.EvictIfNecessary () [0x00000] in <filename unknown>:0 
  at System.Web.Caching.Cache.SetItemTimeout (System.Web.Caching.CacheItem ci, DateTime absoluteExpiration, TimeSpan slidingExpiration, System.Web.Caching.CacheItemRemovedCallback onRemoveCallback, System.Web.Caching.CacheItemUpdateCallback onUpdateCallback, System.String key, Boolean doLock) [0x00000] in <filename unknown>:0 
  at System.Web.Caching.Cache.Insert (System.String key, System.Object value, System.Web.Caching.CacheDependency dependencies, DateTime absoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority, System.Web.Caching.CacheItemRemovedCallback onRemoveCallback, System.Web.Caching.CacheItemUpdateCallback onUpdateCallback, Boolean doLock) [0x00000] in <filename unknown>:0 
  at System.Web.Caching.Cache.Insert (System.String key, System.Object value, System.Web.Caching.CacheDependency dependencies, DateTime absoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority, System.Web.Caching.CacheItemRemovedCallback onRemoveCallback) [0x00000] in <filename unknown>:0 
  at System.Web.SessionState.SessionInProcHandler.InsertSessionItem (System.Web.SessionState.InProcSessionItem item, Int32 timeout, System.String id) [0x00000] in <filename unknown>:0 
  at System.Web.SessionState.SessionInProcHandler.SetAndReleaseItemExclusive (System.Web.HttpContext context, System.String id, System.Web.SessionState.SessionStateStoreData item, System.Object lockId, Boolean newItem) [0x00000] in <filename unknown>:0 
Version information: Mono Runtime Version: 2.10.8.1 (Debian 2.10.8.1-1ubuntu2.2); ASP.NET Version: 4.0.30319.1

这是项目的web.config文件:

 <?xml version="1.0"?>
 <!--
 The settings that can be used in this file are documented at 
 http://www.mono-project.com/Config_system.web and 
 http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
 -->
 <configuration>
   <configSections>
     <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
       <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
         <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
       </sectionGroup>
     </sectionGroup>
   </configSections>
   <system.web>
     <!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.
        -->
     <compilation defaultLanguage="C#" debug="false">
       <assemblies>
         <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
         <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
         <add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
         <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
         <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
         <add assembly="System.Web.DynamicData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
         <add assembly="System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
         <add assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
       </assemblies>
     </compilation>
     <customErrors mode="Off">
     </customErrors>
     <pages>
       <controls>
         <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
         <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
       </controls>
       <namespaces>
         <add namespace="System.Web.Mvc" />
         <add namespace="System.Web.Mvc.Ajax" />
         <add namespace="System.Web.Mvc.Html" />
         <add namespace="System.Web.Routing" />
         <add namespace="System.Linq" />
         <add namespace="System.Collections.Generic" />
       </namespaces>
     </pages>
     <authorization>
       <allow users="*" />
     </authorization>
     <httpHandlers>
       <remove verb="*" path="*.asmx" />
       <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
       <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
       <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
       <add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
     </httpHandlers>
     <httpModules>
       <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
       <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
     </httpModules>
     <trace enabled="false" localOnly="true" pageOutput="false" requestLimit="10" traceMode="SortByTime" />
     <globalization requestEncoding="utf-8" responseEncoding="utf-8" />
   </system.web>
   <system.codedom>
     <compilers>
       <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
         <providerOption name="CompilerVersion" value="v4.0" />
         <providerOption name="WarnAsError" value="false" />
       </compiler>
       <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
         <providerOption name="CompilerVersion" value="v4.0" />
         <providerOption name="OptionInfer" value="true" />
         <providerOption name="WarnAsError" value="false" />
       </compiler>
     </compilers>
   </system.codedom>
   <system.web.extensions />
   </configuration>

这是具有例外的控制器:

public class APIController : Controller
{
    public string Index()
    {
        return "Hello";
    }
}

1 个答案:

答案 0 :(得分:0)

您可以尝试按照here所述禁用缓存。

至少它会显示问题是否真的与此有关。