Umbraco Child MVC应用程序(虚拟目录) - 无法加载文件或程序集Umbraco.ModelsBuilder

时间:2016-04-25 23:55:19

标签: asp.net-mvc umbraco

我试图将自定义的纯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安装程序
  6. 注意:到目前为止,一切都按预期工作。我可以登录后台或浏览新的Umbraco网站..

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

      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

1 个答案:

答案 0 :(得分: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>