gpt4 book ai didi

c# - Web 表单路由 - 无法创建抽象类

转载 作者:行者123 更新时间:2023-11-30 15:50:23 24 4
gpt4 key购买 nike

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

我正在运行 Windows Vista,IIS 7.0,集成模式。

下面是YSOD:

Cannot create an abstract class.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.MissingMethodException: Cannot create an abstract class.

Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: [MissingMethodException: Cannot create an abstract class.] 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.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;}
}

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

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

我在我的网络配置中设置了路由,当我尝试访问 http://local.url/pageName 时我根据以上信息体验了 YSOD。

谁能帮忙解决这个问题?

干杯

最佳答案

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

交叉发布对我有帮助的内容:

In Web.config -> system.webserver -> handlers, replace

  <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"/>

With:

  <add name="UrlRoutingHandler"
preCondition="integratedMode" verb="*"
path="UrlRouting.axd"
type="System.Web.HttpForbiddenHandler,
System.Web, Version=2.0.0.0,
Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />

关于c# - Web 表单路由 - 无法创建抽象类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/677961/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com