这是我在此stackoverflow中的第一篇文章。我希望正确地做。
我花费数小时寻找没有结果的解决方案。我正在使用Umbraco
版本7.5.7组装:1.0.6219.11990
我将Visual Studio Express 2015用于Web,如果我使用调试器(F5)运行该项目,我没有问题,并且我的开发网站效果很好。如果我没有调试器(CTRL F5)运行该项目,则无效
在有或没有调试器按钮的情况下运行
这是抛出的例外:
system.invalidoperationException:未创建在'〜/views/homepage.cshtml'的视图。
我在所有页面中都有相同的问题,但我可以在任何模式下正确输入umbraco设置页面。
有什么想法?
错误的屏幕快照
[编辑]包括主(布局)和主页的代码,但我在所有页面中都有相同的问题
这是"主"代码:
@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>
这是主页代码:
@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>
我遇到了相同的问题,对我而言,它解决的是编辑web.config并找到此值:
Umbraco.ModelsBuilder.ModelsMode
将其更改为Dll
或LiveAppData
,而不是默认的PureLive
修复了它。
如果您不使用型号构建器功能,也可以将Umbraco.ModelsBuilder.Enable
设置为false
。
我也遇到了这个问题,我尝试更改ModelsMode,但它仅更改了错误消息。对我来说,解决方案是简单的问题,可以回到CMS并重新播放Doctype。因此,最终我把它留在了purelive上,保存了一切后。