作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是我在这个 stackoverflow 中的第一篇文章。我希望正确地做到这一点。
我花了几个小时寻找没有结果的解决方案。我正在使用 Umbraco
7.5.7 版程序集:1.0.6219.11990
我使用 Visual Studio Express 2015 For Web,如果我用调试器 (f5) 运行项目,我没有问题,我开发的网站运行良好。如果我在没有调试器 (ctrl+f5) 的情况下运行项目,则没有任何效果
run with or without debugger buttons
这是抛出的异常:
System.InvalidOperationException: The view found at '~/Views/Homepage.cshtml' was not created.
@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
如果您没有使用模型构建器功能。
关于Umbraco: "System.InvalidOperationException: The view found at ' ~/Views/Homepage.cshtml' 未创建。”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42713652/
我是一名优秀的程序员,十分优秀!