3

Net 3.5 SP1 并尝试将http://haacked.com/archive/2008/03/11/using-routing-with-webforms.aspx的示例副本实现到示例 Web 应用程序中,但是我似乎遇到了一些问题。

我正在运行 windows vista、IIS 7.0、集成模式。

以下是 YSOD:

无法创建抽象类。

说明:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息: System.MissingMethodException:无法创建抽象类。

源错误:在执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常起源和位置的信息。

堆栈跟踪:[MissingMethodException:无法创建抽象类。] System.RuntimeTypeHandle.CreateInstance(RuntimeType 类型,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 文化, Object[] activationAttributes) +1051 System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfoculture, Object[] activationAttributes) +111 System.Web.Configuration.HandlerFactoryCache..ctor(String type) +57 System.Web.HttpApplication.GetFactory(String type) +78 System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +229 System.Web. HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

我有一个看起来像这样的界面:

public interface IRoutablePage : IHttpHandler
{
    UrlHelper Url { get; }
    HtmlHelper Html { get; }
    RequestContext RequestContext { get; set;}
}

我有一个抽象类(RouteablePage),它继承了这个接口和 System.Web.UI.Page。

然后我有一个网页(附加到母版页),它继承了 RoutablePage 类。

我在我的 Web 配置中设置了路由,当我尝试访问http://local.url/pageName时,我体验到带有上述信息的 YSOD。

有人可以帮忙解决这个问题吗?

干杯

4

2 回答 2

4

我有同样的问题。我能够在这个论坛上找到答案http://forums.asp.net/t/1272109.aspx

交叉发布对我有帮助的东西:

在 Web.config -> system.webserver -> 处理程序中,替换

  <add name="UrlRoutingHandler"
 preCondition="integratedMode" verb="*"
 path="UrlRouting.axd"
 type="System.Web.Routing.UrlRoutingHandler,
 System.Web.Routing, Version=0.0.0.0,
 Culture=neutral,
 PublicKeyToken=31BF3856AD364E35"/>

和:

  <add name="UrlRoutingHandler"
 preCondition="integratedMode" verb="*"
 path="UrlRouting.axd"
 type="System.Web.HttpForbiddenHandler,
 System.Web, Version=2.0.0.0,
 Culture=neutral,
 PublicKeyToken=b03f5f7f11d50a3a" />
于 2009-07-20T07:47:38.760 回答
0

该问题已暂时解决。在IIS7下运行网站会出现上述问题,使用cassini运行网站,每次都按预期运行,没有错误。

但是,将不胜感激有关此问题的任何进一步信息。

于 2009-03-25T00:25:25.443 回答