本文介绍了Umbraco子MVC应用程序(虚拟目录)-无法加载文件或程序集Umbraco.ModelsBuilder的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Umbraco 7网站根目录下将自定义的纯ASP.NET MVC应用程序部署为虚拟目录应用程序".但是,我总是收到以下YSOD错误:

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. 创建了一个全新的空ASP.NET解决方案/项目
  2. 添加了UmbracoCms nuget包(7.4.3)
  3. 构建解决方案
  4. 使用主机名 umbraco-demo.local
  5. 设置我的IIS站点-"UmbracoDemo"
  6. 浏览到 http://umbraco-demo.local 并运行Umbraco安装程序
  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

注意:到目前为止,一切正常.我可以登录后台或浏览新的Umbraco网站.

  1. 在名为"DemoApp"的新VS解决方案中创建了一个新的ASP.NET MVC应用程序.
  2. 构建新解决方案并立即使用IIS Express运行它-MVC应用程序正常运行
  3. 在IIS管理器中,我右键单击UmbracoDemo网站,并添加了一个名为"DemoApp"的应用程序",将其指向DemoApp MVC项目目录
  4. 在Umbraco的web.config的 umbracoReservedPaths 设置中添加了〜/DemoApp"
  5. 浏览到 http://umbraco-demo.local/DemoApp
  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

再次出现错误:

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


其他信息:

我不认为这与ModelsBuilder特别相关.为了看看会发生什么,我将其添加到"DemoApp" web.config:

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>

现在错误消息显示:

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

自然,我尝试添加:

<remove assembly="UrlRewritingNet.UrlRewriter" />

但这没有影响,错误仍然存​​在.在另一种情况下,该错误提到了一个不同的程序集,而不是 UrlRewritingNet.UrlRewriter .

But this had no impact, the error remained. And in another instance the error mentioned a different assembly instead of UrlRewritingNet.UrlRewriter.

推荐答案

我通过将〜/api/添加到:-

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

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

然后用位置标记包装我的父umbraco应用程序的以下web.config部分:-

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

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

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

这篇关于Umbraco子MVC应用程序(虚拟目录)-无法加载文件或程序集Umbraco.ModelsBuilder的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 12:54