实现 URLRewriter.Net 会出现引用异常
按照此处的说明操作后
如何要使用 UrlRewriter.Net 实现 URL 重写?
我收到引用异常 -->
“/”应用程序中的服务器错误。
你调用的对象是空的。 [NullReferenceException:未将对象引用设置为对象的实例。] Intelligencia.UrlRewriter.Configuration.RewriterConfiguration.Load() +109 Intelligencia.UrlRewriter.Configuration.RewriterConfiguration.get_Current() +216 Intelligencia.UrlRewriter.RewriterHttpModule..cctor() +47
[TypeInitializationException:“Intelligencia.UrlRewriter.RewriterHttpModule”的类型初始值设定项引发了异常。]
[TargetInitationException:调用目标已引发异常。] System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(布尔publicOnly,布尔fillCache)+86 System.RuntimeType.CreateInstanceImpl(布尔publicOnly,布尔skipVisibilityChecks,布尔fillCache)+230 System.Activator.CreateInstance(类型类型,布尔非公共)+67 System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr,活页夹活页夹,对象[]参数,CultureInfo文化,对象[]激活属性)+1051 System.Activator.CreateInstance(类型类型,BindingFlags bindingAttr,活页夹活页夹,对象[] args,CultureInfo文化,对象[]activationAttributes)+111 System.Web.Configuration.Common.ModulesEntry.Create() +39 System.Web.Configuration.HttpModulesSection.CreateModules() +164 System.Web.HttpApplication.InitModules() +28 System.Web.HttpApplication.InitInternal(HttpContext上下文,HttpApplicationState状态,MethodInfo []处理程序)+729 System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext上下文)+298 System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +289
我添加了标签,因为我已经读到,当您没有添加标签时,大多数时候都会弹出此错误web.config 中指定的重写器部分。 那么现在可能出现什么问题呢? 我试图在 IIS 6.0 (windows 2003) 服务器上运行它。
After following the instructions here
How To Implement URL rewriting with UrlRewriter.Net?
I'm getting a Referenece Exception -->
Server Error in '/' Application.
Object reference not set to an instance of an object.
[NullReferenceException: Object reference not set to an instance of an object.]
Intelligencia.UrlRewriter.Configuration.RewriterConfiguration.Load() +109
Intelligencia.UrlRewriter.Configuration.RewriterConfiguration.get_Current() +216
Intelligencia.UrlRewriter.RewriterHttpModule..cctor() +47
[TypeInitializationException: The type initializer for 'Intelligencia.UrlRewriter.RewriterHttpModule' threw an exception.]
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +86
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +230
System.Activator.CreateInstance(Type type, Boolean nonPublic) +67
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1051
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +111
System.Web.Configuration.Common.ModulesEntry.Create() +39
System.Web.Configuration.HttpModulesSection.CreateModules() +164
System.Web.HttpApplication.InitModules() +28
System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +729
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +298
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +289
I have added the tag because I have read that this error most of the times pops up when you don't have the rewriter section specified in your web.config.
So what can be the problem now?
I'm trying to run this on an IIS 6.0 (windows 2003) server.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该模块无法在 IIS 6.0 上运行,因为 URLRewrite 模块 2.0 仅可作为 IIS 7.0 的扩展。
This module won't be able to run on IIS 6.0 since the URLRewrite module 2.0 is only available for IIS 7.0 as an extension.