gpt4 book ai didi

asp.net-mvc - MVC 2 预览 1 - Controller 中带有参数的方法无法加载

转载 作者:行者123 更新时间:2023-12-01 04:21:53 25 4
gpt4 key购买 nike

自 MVC 1.0 升级我的网站以来加载了大量页面,但如果我转到使用查询字符串的页面,则会收到此错误:

[EntryPointNotFoundException: Entry point was not found.]
System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) +219
System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +109
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +399
System.Web.Mvc.Controller.ExecuteCore() +126
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +27
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +151
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +57
System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

编辑

我认为这与结构图有关,因为 MVC 2 破坏了模型,所以我更改了 DefaultControllerFactory 但我已经能够从数据库中提取数据,所以结构图不是问题吗?
protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
{
try
{
return ObjectFactory.GetInstance(controllerType) as Controller;

}
catch (StructureMapException)
{
System.Diagnostics.Debug.WriteLine(ObjectFactory.WhatDoIHave());
throw;
}
}

最佳答案

您是否在项目中添加了程序集绑定(bind)?我有几乎相同的错误,它为我解决了问题。从发行说明:

4.  If the project references any third-party libraries that are compiled against ASP.NET MVC 1.0, add the following bindingRedirect element to the Web.config file in the application root under the configuaton section:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc"
publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>

关于asp.net-mvc - MVC 2 预览 1 - Controller 中带有参数的方法无法加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1212087/

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