简体   繁体   中英

Mono ASP.NET Exception

Has anyone else ever had this error running on xsp on mono ASP.NET? I think it's to do with caching, but there is no mention of caching in the Web.config file, so I haven't intentionally turned anything on.

This only occurs after a few days of uptime and fixes itself if the server is restarted.

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

Here is the project's web.config file:

 <?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>

Here is the controller that has the exception:

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

You could try to disable the cache as discussed here .

At least it would show if the problem really is related to that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM