HttpException in Html.RenderAction after installing Visual Studio 2010 Pro RTM RRS feed

  • Question

  • User1482956676 posted


    I get an HttpException (details below) after installing Visual Studio 2010 Pro RTM in an application developed using Visual Studio 2010 RC. The platform used was ASP.NET MVC2 RTW (already under VS10 RC).

    I first uninstalled all RC software and even ASP.NET MVC 2, and then did a "clean" install of VS10 RTM. The ASP.NET MVC 2 version now installed on my dev machine is 2.0.50217.0.

    Exception Message:
    Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.

    InnerException Message:
    <FilePath>\Views\Language\RenderLanguageNavigation.ascx(6): error BC30451: 'Model' is not declared. It may be inaccessible due to its protection level.

     The error occurs on this "Html.RenderAction":

    <div id="langNav">
       <% Html.RenderAction("RenderLanguageNavigation", "Language") %>

     The "LanguageController" just calls into another service function as below:

    Public Shared Function GetLanguagesReadOnly() As IEnumerable(Of Language)
       Dim result As IEnumerable(Of Language)
       Using ctx As New MyEntities
           result = (From l In ctx.Languages
                        Order By l.Name Ascending
                        Select l).ToList
       End Using
       Return result
    End Function

    Does anybody have an idea what is causing the problem?


    By the way, I might also share the actual view (partial view) that would show the languages to select from:

    <%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl(Of IEnumerable(Of Language))" %>
    <%= "" %>
    <ul class="langNav">
        For Each item In Model%>
        <li><%= Html.ActionLink(item.Name, "SwitchLanguage", "Language", 
                           New With {.id = item.Code.Trim,
                                     .redirectUrl = Context.Request.RawUrl}, Nothing)%></li>
    <% Next %>


    Tuesday, April 13, 2010 8:56 AM


  • User1482956676 posted

    Well, I found the problem. I needed to explictly add "System.Data.Entity" to the web.config like so:

     <compilation debug="true" targetFramework="4.0">
       <add assembly="System.Web.Abstractions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
       <add assembly="System.Web.Routing, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
       <add assembly="System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Data.Entity, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

    Hope this helps other people migrating vom VS10 RC to VS10 RTM.


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 13, 2010 5:06 PM