我在用Microsoft.ApplicationBlocks.Cache的时候程序没有发生异常抛出,但是在事件查看其里面就会出现以下的错误
General Information 
*********************************************
Additional Info:
ExceptionManager.MachineName: LJM
ExceptionManager.TimeStamp: 2006-8-10 15:06:09
ExceptionManager.FullName: Microsoft.ApplicationBlocks.ExceptionManagement, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
ExceptionManager.AppDomainName: /LM/W3SVC/1/Root/E2HV3WebSite-7-127996670412187500
ExceptionManager.ThreadIdentity: LJM\Administrator
ExceptionManager.WindowsIdentity: NT AUTHORITY\NETWORK SERVICE1) Exception Information
*********************************************
Exception Type: System.ArgumentOutOfRangeException
Message: Key cannot be empty.
参数名: key
ActualValue: NULL
ParamName: key
Data: System.Collections.ListDictionaryInternal
TargetSite: Void RemoveItem(System.String, Microsoft.ApplicationBlocks.Cache.CacheItemRemoveCause)
HelpLink: NULL
Source: Microsoft.ApplicationBlocks.CacheStackTrace Information
*********************************************
   在 Microsoft.ApplicationBlocks.Cache.CacheService.RemoveItem(String key, CacheItemRemoveCause cause)有关更多信息,请参阅在 http://go.microsoft.com/fwlink/events.asp 的帮助和支持中心。-----------------------------------------
错误使得w3wp.exe发生异常而重启。请高手们帮忙。
分不够再加,加到你满意为止。

解决方案 »

  1.   

    我就只有一个类里面用的Microsoft.ApplicationBlocks.Cache,就是不知道哪里有问题,程序好像根本捕捉不到这个异常。
    按照提示:
    Exception Type: System.ArgumentOutOfRangeException
    Message: Key cannot be empty.
    参数名: key
    ActualValue: NULL
    ParamName: key
    Data: System.Collections.ListDictionaryInternal
    TargetSite: Void RemoveItem(System.String, Microsoft.ApplicationBlocks.Cache.CacheItemRemoveCause)
    HelpLink: NULL
    Source: Microsoft.ApplicationBlocks.Cache
    应该是从缓存中remove一个对象的时候key为空值造成的,但是我已经在程序加了判断还是不行。
    程序如下:
            public static void RemoveCachedEntity(object entity)
            {
                try
                {
                    if (object.Equals(entity, null))
                    {
                        return;
                    }
                    CacheManager cm = CacheManager.GetCacheManager();
                    cm.Remove(EntityKeyGenerator.GenerateKey(entity));
                }
                catch
                {
                }
            }我把Microsoft.ApplicationBlocks.Cache反编译来看过提示中的Void RemoveItem这个函数,其实内部都作了判断。
      

  2.   

    是不是在remove之前对象就在别的地方已经被释放掉了?