这是发表于:2007-07-02 20:36:35的问题:
URLRewriter错误,在网上搜了半天都找不到答案,大家帮我看看具体如下:
“/”应用程序中的服务器错误。
--------------------------------------------------------------------------------未将对象引用设置到对象的实例。异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。
堆栈跟踪: 
[NullReferenceException: 未将对象引用设置到对象的实例。]
   URLRewriter.RewriterFactoryHandler.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +130
   System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +175
   System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +120
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155 
从网上的搜索结果来看,
http://www.cnblogs.com/notus/archive/2007/07/04/710493.html
是缓存的问题。说实话,没看出来这篇博文到底解决了没。如何解决呢?

解决方案 »

  1.   

    URLRewriter这个没有用过,一般自己写url重写过程
      

  2.   

     是不是没引用DLL 看看IIS配置  WEB.CONFIG配置我用没出啥问题。。 
      

  3.   

    用的是微软的urlrewrite组件,都实现并且成功了。唯一的不足是偶尔出现这种异常,好像网上还没有解决办法。
      

  4.   

    我用的比较笨拙的方式 在global里面code 
    LZ说的那个东东 以后尝试下
      

  5.   

    是不是缓存的问题,你把他的代码下来,把缓存屏蔽掉,再上去试几天,看还出不出这个问题了,就知道了吧?呵呵
    默认的urlrewrite里写的效率并不高,建议你下来后,修改一下适合自己用的
      

  6.   

    把你URLRewriter的规则贴出来,这样很难知道哪里的配置错误!
      

  7.   

    缓存问题? .aspx的页面缓存?那就试试局部缓存
      

  8.   

    这个太难了。。
    http://www.icanwell.cn
      

  9.   

    没有
    这个是代码,请大家帮我看看哪些可以注释掉,或者改成System.Web.Caching.CacheItemPriority.NotRemovable
    请主要看红色字部分。
    using System;
    using System.Web;
    using System.Web.Caching;
    using System.Configuration;
    using System.Xml.Serialization;namespace URLRewriter.Config
    {
    /// <summary>
    /// Specifies the configuration settings in the Web.config for the RewriterRule.
    /// </summary>
    /// <res>This class defines the structure of the Rewriter configuration file in the Web.config file.
    /// Currently, it allows only for a set of rewrite rules; however, this approach allows for customization.
    /// For example, you could provide a ruleset that <i>doesn't</i> use regular expression matching; or a set of
    /// constant names and values, which could then be referenced in rewrite rules.
    /// <p />
    /// The structure in the Web.config file is as follows:
    /// <code>
    /// &lt;configuration&gt;
    ///  &lt;configSections&gt;
    ///  &lt;section name="RewriterConfig" 
    ///              type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" /&gt;
    /// &lt;/configSections&gt;
    ///
    /// &lt;RewriterConfig&gt;
    /// &lt;Rules&gt;
    /// &lt;RewriterRule&gt;
    /// &lt;LookFor&gt;<i>pattern</i>&lt;/LookFor&gt;
    /// &lt;SendTo&gt;<i>replace with</i>&lt;/SendTo&gt;
    /// &lt;/RewriterRule&gt;
    /// &lt;RewriterRule&gt;
    /// &lt;LookFor&gt;<i>pattern</i>&lt;/LookFor&gt;
    /// &lt;SendTo&gt;<i>replace with</i>&lt;/SendTo&gt;
    /// &lt;/RewriterRule&gt;
    /// ...
    /// &lt;RewriterRule&gt;
    /// &lt;LookFor&gt;<i>pattern</i>&lt;/LookFor&gt;
    /// &lt;SendTo&gt;<i>replace with</i>&lt;/SendTo&gt;
    /// &lt;/RewriterRule&gt;
    /// &lt;/Rules&gt;
    /// &lt;/RewriterConfig&gt;
    ///
    /// &lt;system.web&gt;
    /// ...
    /// &lt;/system.web&gt;
    /// &lt;/configuration&gt;
    /// </code>
    /// </res>
    [Serializable()]
    [XmlRoot("RewriterConfig")]
    public class RewriterConfiguration
    {
    // private member variables
    private RewriterRuleCollection rules; // an instance of the RewriterRuleCollection class... /// <summary>
    /// GetConfig() returns an instance of the <b>RewriterConfiguration</b> class with the values populated from
    /// the Web.config file.  It uses XML deserialization to convert the XML structure in Web.config into
    /// a <b>RewriterConfiguration</b> instance.
    /// </summary>
    /// <returns>A <see cref="RewriterConfiguration"/> instance.</returns>
    public static RewriterConfiguration GetConfig()
    {
    if (HttpContext.Current.Cache["RewriterConfig"] == null)
    HttpContext.Current.Cache.Insert("RewriterConfig", ConfigurationSettings.GetConfig("RewriterConfig"));
                
    return (RewriterConfiguration) HttpContext.Current.Cache["RewriterConfig"];
    }

    #region Public Properties
    /// <summary>
    /// A <see cref="RewriterRuleCollection"/> instance that provides access to a set of <see cref="RewriterRule"/>s.
    /// </summary>
    public RewriterRuleCollection Rules
    {
    get
    {
    return rules;
    }
    set
    {
    rules = value;
    }
    }
    #endregion
    }
    }
      

  10.   

    我这边解决了!
    你解决了吗?
    如果需要,请联系我
    我就是在urlrewriter开源的代码里进行了修改,重新生成了无错误版的dll