【问题标题】:Umbraco Child MVC Application (Virtual Directory) - Could not load file or assembly Umbraco.ModelsBuilderUmbraco 子 MVC 应用程序(虚拟目录) - 无法加载文件或程序集 Umbraco.ModelsBuilder
【发布时间】:2016-04-25 23:55:19
【问题描述】:

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

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.

我也从头开始尝试过,以消除尽可能多的变量。以下是重现步骤:

  1. 创建了一个全新的空 ASP.NET 解决方案/项目
  2. 添加了 UmbracoCms nuget 包 (7.4.3)
  3. 构建解决方案
  4. 设置我的 IIS 站点 - “UmbracoDemo”,主机名为 umbraco-demo.local
  5. 浏览到 http://umbraco-demo.local 并运行 Umbraco 安装程序

注意:到目前为止,一切都按预期工作。我可以登录后台或浏览新的 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

我再次收到错误:

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

其他信息:

我认为这与 ModelsBuilder 没有特别的关系。为了看看会发生什么,我将它添加到我的“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

【问题讨论】:

    标签: asp.net-mvc umbraco


    【解决方案1】:

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

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

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

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-01-23
      • 1970-01-01
      • 1970-01-01
      • 2016-06-28
      • 1970-01-01
      • 1970-01-01
      • 2018-01-26
      相关资源
      最近更新 更多