MVC 4 @Scripts “does not exist”

后端 未结 24 2007
长发绾君心
长发绾君心 2020-12-12 11:20

I have just created an ASP.NET MVC 4 project and used Visual Studio 2012 RC to create a Controller and Razor Views for Index and Create Actions.

24条回答
  •  青春惊慌失措
    2020-12-12 12:20

    When I enter on a page that haves this code:

    @section Scripts {
        @Scripts.Render("~/bundles/jqueryval")
    }
    

    This error occurs: Error. An error occurred while processing your request.

    And this exception are recorded on my logs:

    System.Web.HttpException (0x80004005): The controller for path '/bundles/jqueryval' was not found or does not implement IController.
       em System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType)
    ...
    

    I have tried all tips on this page and none of them solved for me. So I have looked on my Packages folder and noticed that I have two versions for System.Web.Optmization.dll:

    • Microsoft.AspNet.Web.Optimization.1.1.0 (v1.1.30515.0 - 68,7KB)
    • Microsoft.Web.Optimization.1.0.0-beta (v1.0.0.0 - 304KB)

    My project was referencing to the older beta version. I only changed the reference to the newer version (69KB) and eveything worked fine.

    I think it might help someone.

提交回复
热议问题