这是发表于: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
是缓存的问题。说实话,没看出来这篇博文到底解决了没。如何解决呢?
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
是缓存的问题。说实话,没看出来这篇博文到底解决了没。如何解决呢?
LZ说的那个东东 以后尝试下
默认的urlrewrite里写的效率并不高,建议你下来后,修改一下适合自己用的
http://www.icanwell.cn
这个是代码,请大家帮我看看哪些可以注释掉,或者改成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>
/// <configuration>
/// <configSections>
/// <section name="RewriterConfig"
/// type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
/// </configSections>
///
/// <RewriterConfig>
/// <Rules>
/// <RewriterRule>
/// <LookFor><i>pattern</i></LookFor>
/// <SendTo><i>replace with</i></SendTo>
/// </RewriterRule>
/// <RewriterRule>
/// <LookFor><i>pattern</i></LookFor>
/// <SendTo><i>replace with</i></SendTo>
/// </RewriterRule>
/// ...
/// <RewriterRule>
/// <LookFor><i>pattern</i></LookFor>
/// <SendTo><i>replace with</i></SendTo>
/// </RewriterRule>
/// </Rules>
/// </RewriterConfig>
///
/// <system.web>
/// ...
/// </system.web>
/// </configuration>
/// </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
}
}
你解决了吗?
如果需要,请联系我
我就是在urlrewriter开源的代码里进行了修改,重新生成了无错误版的dll