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

标签 asp.net-mvc

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

相关文章:

javascript - ASP.Net MVC jQuery 和插件加载顺序错误

c# - 如何在 asp.net mvc 中使用 {SiteName} 处理 [Authorize]

asp.net-mvc - 如何为 MVC3 中除特殊 URL 之外的所有 URL 运行自定义路由

asp.net-mvc - 如何在 Azure 网站上获取错误详细信息

c# - MVC onfocusout 事件未触发

ASP.NET 路由未按预期触发

c# - Linq to SQL - 在 Html.TextBoxFor 中格式化 DateTime

javascript - MVC javascript显示选定的数据

c# - 我的 Dispose 方法会在 ASP.NET 请求结束时被调用吗

asp.net - 在 ASP.NET MVC Web API 服务和 MVC 客户端架构中实现身份验证和基于角色的授权