【问题标题】:The call is ambiguous between the following methods or properties: 'Umbraco.Web.UmbracoHelper.Media(params int[])' and 'Umbraco.Web.UmbracoHelper以下方法或属性之间的调用不明确:'Umbraco.Web.UmbracoHelper.Media(params int[])' 和 'Umbraco.Web.UmbracoHelper
【发布时间】:2021-01-17 22:51:33
【问题描述】:

我最近尝试将我的网站从 U7.15.6 升级到 U8。我刚刚使用 FileZilla 将 /bin /umbraco /config 复制到了我当前的网站

当我尝试回滚到 U7.15.6 时出现以下错误:

以下方法或属性之间的调用不明确:'Umbraco.Web.UmbracoHelper.Media(params int[])' 和 'Umbraco.Web.UmbracoHelper.Media(params string[])' 描述:未处理的异常在当前 Web 请求执行期间发生。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:Microsoft.CSharp.RuntimeBinder.RuntimeBinderException:以下方法或属性之间的调用不明确:“Umbraco.Web.UmbracoHelper.Media(params int[])”和“Umbraco.Web.UmbracoHelper.Media(参数字符串[])'

来源错误:

Line 20:    var section_node = Umbraco.Content(1xxx);    
Line 21:    var Section_pagesToList = @Section_node.Children.Where("Visible");
Line 22:    Section_pagesToList = Section_node.DescendantsOrSelf().Where("NodeTypeAlias == @0", "NewsPage");

所以我做了什么,我将第 21 行更改如下:

string[] Section_pagesToList = @Section_node.Children.Where("Visible");

但现在我在页面的其他部分出现另一个错误 - 我在其中显示本节的特色图片:

 Line 81:               <div class="col-xl-6 col-lg-6 col-md-4 MainNewsBox">
Line 82:                    <figure>
Line 83:                        @if (Section_pagesToList.Last().HasValue("articleImg"))     

第83行的错误是:

Compiler Error Message: CS1929: 'string' does not contain a definition for 'HasValue' and the best extension method overload 'PublishedContentExtensions.HasValue(IPublishedContent, string)' requires a receiver of type 'IPublishedContent'

如何解决这个问题并恢复我的网站?

谢谢。

【问题讨论】:

    标签: razor umbraco umbraco7 umbraco8


    【解决方案1】:

    如果您无法通过 VCS 回滚,我认为您需要重新安装 v7.15.6 才能恢复正确的 DLL。也许借此机会开始使用 Nuget。关于 v7 -> v8 没有直接的升级方法。在 https://our.umbraco.com 上,您可以找到有关如何迁移 (!) 到 v8 的更多信息。

    【讨论】:

    • 嗨,我已经尝试通过从我的服务器中删除 /bin /umbraco /umbraco_client /config 等来回滚并复制我从 our.umbraco 下载的新文件夹 - 没有成功。然后,我尝试使用 Visual Studio 和 Nuget 在本地安装,但是当我将 .sdf 粘贴到本地 App_Data 时,我在本地也遇到了上述错误。会不会是 V8 改变了我的数据库?
    猜你喜欢
    • 2012-02-09
    • 1970-01-01
    • 2020-01-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多