0

(这是来自 umbraco 论坛的交叉帖子。)

我已经建立了一个站点,并且在本地一切正常。我刚刚将我的站点部署到 Azure,并使用 SSMS 的将数据库部署到 Microsoft Azure SQL 数据库功能发布了我的数据库。两者都顺利完成。我可以登录 umbraco 并在 Azure 站点上查看我在本地拥有的所有内容,但是当我尝试访问主页时,我得到一个 YSOD,并出现以下错误。

我可以登录 CMS 并查看我的所有内容。

发生了什么?我错过了什么?

错误:

Server Error in '/' Application.
Cannot bind source content type Umbraco.Web.PublishedCache.NuCache.PublishedContent to model type Foo.PublishedContentModels.Home.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Umbraco.Web.Mvc.ModelBindingException: Cannot bind source content type Umbraco.Web.PublishedCache.NuCache.PublishedContent to model type Foo.PublishedContentModels.Home.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[ModelBindingException: Cannot bind source content type Umbraco.Web.PublishedCache.NuCache.PublishedContent to model type Foo.PublishedContentModels.Home.]
   Umbraco.Web.Mvc.ContentModelBinder.ThrowModelBindingException(Boolean sourceContent, Boolean modelContent, Type sourceType, Type modelType) in D:\a\1\s\src\Umbraco.Web\Mvc\ContentModelBinder.cs:159
   Umbraco.Web.Mvc.ContentModelBinder.BindModel(Object source, Type modelType) in D:\a\1\s\src\Umbraco.Web\Mvc\ContentModelBinder.cs:94
   Umbraco.Web.Mvc.UmbracoViewPage`1.SetViewData(ViewDataDictionary viewData) in D:\a\1\s\src\Umbraco.Web\Mvc\UmbracoViewPageOfTModel.cs:152
   System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +99
   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +107
   Umbraco.Web.Mvc.ProfilingView.Render(ViewContext viewContext, TextWriter writer) in D:\a\1\s\src\Umbraco.Web\Mvc\ProfilingView.cs:25
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +291
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
4

1 回答 1

1

我所做的是禁用 modelsBuilder 与配置转换去 Azure 没有意识到这禁用 Model Binder以及 Model Builder

<add key="Umbraco.ModelsBuilder.Enable" value="false" xdt:Locator="Match(key)" xdt:Transform="SetAttributes" />

我真正想做的是离开Umbraco.ModelsBuilder.Enable == true 并设置Umbraco.ModelsBuilder.ModelsMode == Nothing

<add key="Umbraco.ModelsBuilder.ModelsMode" value="Nothing" xdt:Locator="Match(key)" xdt:Transform="SetAttributes" />

这按预期工作。

于 2019-12-17T14:20:51.320 回答