Brian Lacy
Brian Lacy

Reputation: 19088

Umbraco Child MVC Application (Virtual Directory) - Could not load file or assembly Umbraco.ModelsBuilder

I'm trying to deploy a custom, pure ASP.NET MVC app as a Virtual Directory "Application" under my Umbraco 7 site root. However, I always get the following YSOD error:

Server Error in '/DemoApp' Application.

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

I've 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. And in another instance the error mentioned a different assembly instead of UrlRewritingNet.UrlRewriter.

Upvotes: 0

Views: 1435

Answers (1)

Codebricks
Codebricks

Reputation: 1253

I got this working by adding ~/api/ to:-

<add key="umbracoReservedPaths" value="~/umbraco,~/install/,~/bundles, ~/api/" />

And then wrapping the following web.config sections of my parent umbraco app with the location tag:-

  <location path="." inheritInChildApplications="false">
    <system.web>

and

  <location path="." inheritInChildApplications="false">
    <system.webServer>

Upvotes: 3

Related Questions