首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Umbraco:"System.InvalidOperationException:未创建‘~/ view /Homepage.cshtml’中的视图。“

Umbraco:"System.InvalidOperationException:未创建‘~/ view /Homepage.cshtml’中的视图。“
EN

Stack Overflow用户
提问于 2017-03-10 08:29:00
回答 2查看 1.7K关注 0票数 6

这是我在堆栈溢出中的第一篇文章。我希望做得对。

我花了几个小时寻找一个没有结果的解决方案。我使用的是Umbraco版本7.5.7程序集: 1.0.6219.11990

我使用2015作为网页,如果我使用调试器(f5)运行这个项目,我没有问题,我开发的站点运行得很好。如果我在没有调试器(ctrl+f5)的情况下运行该项目,则没有任何工作。

使用或不带调试器按钮运行

这是引发的异常:

System.InvalidOperationException:未创建“~/ view /Homepage.cshtml”中的视图。

我在创建的所有页面中都有相同的问题,但我能够在任何模式下正确地输入Umbraco设置页面。

有什么想法吗?

错误截图

编辑包括母版代码(布局)和主页,但我在所有页面上都有相同的问题。

以下是“主”代码:

代码语言:javascript
复制
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using Umbraco.RelationEditor.Extensions;
@using Comp.Umb.Lisa.Models;
@using Comp.Umb.Lisa
@{
    Layout = null;
}

@Html.Partial(LisaContansts.Partials.MetaData)

<link rel="icon" href="~/images/favicon.ico" type="image/x-icon">
<link href="~/css/common.css" rel="stylesheet" />
<link rel="stylesheet" href="~/css/grid.css">
<link rel="stylesheet" href="~/css/style.css">
<link rel="stylesheet" href="~/css/camera.css">
<link rel="stylesheet" href="~/css/search.css">
<link rel="stylesheet" href="~/css/google-map.css">
<link rel="stylesheet" href="~/css/jquery.fancybox.css">
<link rel="stylesheet" href="~/css/subsribe_mailform.css">

<link rel="stylesheet" href="~/css/blocks.css">
<link href="~/css/header.css" rel="stylesheet" type="text/css" />
<script src="~/js/jquery.js"></script>
<script src="~/js/jquery-migrate-1.2.1.js"></script>
<script>
    <!-- analytics -->
</script>
<!--[if lt IE 9]>
<html class="lt-ie9">
<div style=' clear: both; text-align:center; position: relative;'>
  <a href="http://windows.microsoft.com/en-US/internet-explorer/..">
    <img src="images/ie8-panel/warning_bar_0000_us.jpg" border="0" height="42" width="820"
         alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today."/>
  </a>
</div>
<script src="js/html5shiv.js"></script>
<![endif]-->
<script src='~/js/device.min.js'></script>
<div class="page">
    <!--========================================================
                          HEADER
    =========================================================-->
    <header>

        <div id="stuck_container" class="stuck_container">
            <div class="wr">
                <div class="brand">
                    <img class="" src="@Umbraco.Media(CurrentPage.GetPropertyValue("logoHeader", true)).Url" />
                </div>
                <nav class="nav">
                    @{
                    var relatedPagesLang = Model.Content.Related<IPublishedContent>("LisaLangRel");
                    if (relatedPagesLang.Count() > 0)
                    {
                        var langRel = relatedPagesLang.First();
                        <a href="@langRel.Url"><img class="lang" src="@Umbraco.Media(langRel.GetPropertyValue("iconaLingua", true)).Url" /></a>
                    }


                }

                @Html.Partial("_MenuNavigazione")

            </nav>

        </div>
    </div>
</header>

@RenderBody()

<!--========================================================
                          FOOTER
=========================================================-->
<footer>
    <style type="text/css">
        footer{
            background: url(@Umbraco.Media(CurrentPage.GetPropertyValue("immagineSfondo", true)).Url) 50% 50% no-repeat;
        }
    </style>
    <section class="mobile-center">
        <div class="container">
            <div class="row">
                <div class="grid_4">
                    <h6>
                        @CurrentPage.GetPropertyValue("titoloNavigazione", true)
                    </h6>
                    @Html.Partial("_FooterNavigazione")
                </div>
                <div class="prefix_1 grid_3">
                    <h6>
                        @CurrentPage.GetPropertyValue("titoloServizi", true)
                    </h6>
                    @Html.Partial("_FooterServizi")

                </div>
                <div class="prefix_1 grid_3">
                    <div class="prefix_1 grid_3">
                        <h6>@CurrentPage.GetPropertyValue("titoloIndirizzo", true)</h6>
                        <div>
                            @Html.Raw(CurrentPage.GetPropertyValue("indirizzoFooter", true).Replace("\n", "<br />"))
                        </div>

                    </div>
                </div>
            </div>
            <section class="copyright">
                <div class="container">
                    © <span id="copyright-year"></span> @CurrentPage.GetPropertyValue("testoCopyright", true)
                </div>
            </section>
        </div>
    </section>




</footer>

这是主页代码:

代码语言:javascript
复制
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.Homepage>
@using ContentModels = Umbraco.Web.PublishedContentModels;
@using Umbraco.Web.Models;
@using Comp.Umb.Lisa.Models;
@{
Layout = "Master.cshtml";

}
<link rel="stylesheet" href="/css/home.css">
<!--========================================================
                        CONTENT
  =========================================================-->
<main>
@Html.Partial("_Slider")
@{
    DynamicPublishedContent block = CurrentPage.Descendants("titolo_Immagine_Testo_bottone")[0];
    @Html.Partial("_TitleImgLeftTextButton", block);

}

<section class="well wow fadeIn ">
    @{ 
        DynamicPublishedContentList services = CurrentPage.Descendants("servizi").Any()? CurrentPage.Descendants("servizi").FirstOrDefault().Descendants("servizio").Take(4):new DynamicPublishedContentList();
    }
    <div class="container">
        <div class="row">
            @foreach(DynamicPublishedContent service in services)
            {
                @Html.Partial("_ServizioHP", service)
            }

        </div>

    </div>
</section>
@{ 
    DynamicPublishedContent textImg = CurrentPage.Descendants("testoImmagineSfondo").FirstOrDefault();
    @Html.Partial("_TextBackgroundImage", textImg);

    if (CurrentPage.Descendants("titolo_Immagine_Testo_bottone").Count() >= 2)
    {
        //DynamicPublishedContent secondBlock = CurrentPage.Descendants("titolo_Immagine_Testo_bottone")[1];
        @Html.Partial("_TitleImgLeftTextButton", (DynamicPublishedContent)CurrentPage.Descendants("titolo_Immagine_Testo_bottone")[1]);
    }


}
<hr />
    @if (CurrentPage.Descendants(LisaContansts.DocumentTypes.Clienti).Count() > 0)
    {
        @Html.Partial(LisaContansts.Partials.Clienti, (DynamicPublishedContent)CurrentPage.Descendants(LisaContansts.DocumentTypes.Clienti)[0])
    }
</main>
EN

回答 2

Stack Overflow用户

发布于 2017-08-22 09:01:38

我遇到了同样的问题,为我解决这个问题的是编辑web.config并找到这个值:

Umbraco.ModelsBuilder.ModelsMode

将其更改为DllLiveAppData,而不是默认的PureLive修复它。

如果不使用模型构建器功能,也可以将Umbraco.ModelsBuilder.Enable设置为false

票数 3
EN

Stack Overflow用户

发布于 2018-01-11 17:00:50

我也有这个问题,我试图更改ModelsMode,但它只更改了错误消息。对我来说,解决方案很简单,就是回到CMS中,重新保存doctype。所以最终我把它放在了PureLive上,在保存完之后,一切都恢复了。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42713652

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档