Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Brian Lacy 28 posts 101 karma points
    Apr 25, 2016 @ 21:07
    Brian Lacy
    0

    Virtual Directory MVC App - "Could not load file or assembly 'Umbraco.ModelsBuilder'"

    I'm trying to deploy a custom, pure ASP.NET MVC app in a Virtual Directory under the Umbraco site root. I've added the virtual directory to umbracoReservedPaths.

    However I just keep getting the following YSOD error:

    Could not load file or assembly 'Umbraco.ModelsBuilder' or one of its dependencies. The system cannot find the file specified.
    

    The Umbraco site itself works fine, and there are no dependencies on anything Umbraco-related in the MVC app -- in fact I've tried this with a brand new, default MVC app.

    I also tried <remove assembly="Umbraco.ModelsBuilder" /> and this actually eliminated the message, but then I got the same error about another assembly -- Imazen.SlimResponse -- which is also not referenced by the Virtual Directory app, and adding the <remove> directive for this one did NOT help.

    What's going on here??

    EDIT: Technically within IIS this is an "Application" not just a "Virtual Directory".

  • Brian Lacy 28 posts 101 karma points
    Apr 25, 2016 @ 23:56
    Brian Lacy
    0

    Update:

    I've now also tried this from scratch to eliminate as many variables as possible. Here are the repro steps:

    1. Created a brand new empty ASP.NET solution/project
    2. Added the UmbracoCms nuget package (7.4.3)
    3. Built the solution
    4. Setup my IIS Site - "UmbracoDemo" with host name umbraco-demo.local
    5. Browsed to http://umbraco-demo.local and ran the Umbraco installer

    NOTE: So far everything works as expected. I can log into the back office or browse the new Umbraco site..

    1. Created a new ASP.NET MVC application in a new VS solution called "DemoApp"
    2. Built the new solution and ran it immediately with IIS Express -- the MVC app works correctly
    3. In IIS Manager, I right-clicked my UmbracoDemo site and added an "Application" called "DemoApp", pointing it to the DemoApp MVC project directory
    4. Added "~/DemoApp" to the umbracoReservedPaths setting in Umbraco's web.config
    5. Browsed to http://umbraco-demo.local/DemoApp

    Again I get the error:

    Could not load file or assembly 'Umbraco.ModelsBuilder' or one of its dependencies. The system cannot find the file specified.
    

    Additional info:

    I don't think this is specifically related to ModelsBuilder. Just to see what would happen, I added this to my "DemoApp" web.config:

    <assemblies>
      <remove assembly="Umbraco.ModelsBuilder" />
    </assemblies>
    

    Now the error message says:

    Could not load file or assembly 'UrlRewritingNet.UrlRewriter' or one of its dependencies. The system cannot find the file specified.
    

    So naturally, I tried adding:

    <remove assembly="UrlRewritingNet.UrlRewriter" />
    

    But this had no impact, the error remained.

  • inactive 1 post 71 karma points
    Jul 16, 2016 @ 17:16
    inactive
    0

    Hi Brian,

    I found your post as I was getting the same error. For me the child application was taking on the configuration from the main web.config which was for the Umbraco site root.

    I found information on this stackoverflow post here - http://stackoverflow.com/questions/782252/avoid-web-config-inheritance-in-child-web-application-using-inheritinchildapplic#answer-782277

    For me I just wanted to access the application without any Umbraco dependencies and added <clear/> to my DemoApp's 'web.config' file beneath the <configSections> tag and this resolved the YSOD.

    Also it didn't have any effect meantime but would be good to read about the UmbracoReservedPaths key in the Umbraco web.config, I believe your demo app directory should be added here but would need to read up again to find exactly why.

    Hope this helps.

  • Jason Woods 4 posts 96 karma points
    Oct 11, 2016 @ 17:06
    Jason Woods
    1

    After several hours I finally got this to work with a nested MVC application. I added the path to the umbracoReservedPaths, in the parent application.

    Added the following to the nested MVC web.config, not touching parent web.config.

    <system.web>
    <compilation debug="false" targetFramework="4.5.2">
      <assemblies>
        <remove assembly="Umbraco.ModelsBuilder"/>
        <remove assembly="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <remove assembly="UrlRewritingNet.UrlRewriter"/>
      </assemblies>
      <buildProviders>
        <clear/>
      </buildProviders>
    </compilation>
    <httpModules>
      <remove name="UrlRewriteModule"/>
    </httpModules>
    <httpRuntime targetFramework="4.5.2" />
    <roleManager enabled="false">
      <providers>
        <clear/>
      </providers>
    </roleManager>
    

    Hope this helps someone else that is trying to do the same thing.

Please Sign in or register to post replies

Write your reply to:

Draft