在网站上工作我已经开始了,并且突然有几个宏开始播放了。宏工作正常,现在突然出现这个错误,任何人都可以帮助这里是代码。
@using umbraco.MacroEngines
@inherits umbraco.MacroEngines.DynamicNodeContext
@functions{
public void SetPageTitle(string title)
{
var page = HttpContext.Current.Handler as Page;
if (page != null){
page.Title = title;
}
}
public DynamicNode Homepage
{
get {
var homepage = Model;
while(homepage.NodeTypeAlias != "Homepage"){
homepage = homepage.Parent;
}
return homepage;
}
}
public HtmlString GetSocialMediaLink(string network, string url, string name)
{
var socialMediaRepo = Library.NodeById(-1).DescendantsOrSelf("SocialMediaNetworkRepository").First();
var socialNetworks = new List<DynamicNode>();
if (socialMediaRepo != null)
{
foreach (var child in socialMediaRepo.Children)
{
if(child.NodeTypeAlias.ToLower().Equals(network.ToLower())){
var icon = child.HasValue("CssClass") ? String.Format("<i class=\"{0}\"></i>", child.CssClass) : String.Format("<img src=\"/imagegen.ashx?altimage=/images/assets/clear.gif&image={0}\" alt=\"{1}\"/>", child.Icon, child.Name);
return new HtmlString(String.Format("<a target=\"_blank\" rel=\"no-follow\" href=\"{0}\" title=\"{3} on {1}\">{2}</a>", url, child.Name, icon, name) );
}
socialNetworks.Add(child);
}
}
return new HtmlString("");
}
}
@{
if (String.IsNullOrEmpty(Request["name"])){
return;
}
var profileId = Request["name"].Replace("-", " ").Replace("/", "");
var lawyersRepository = Library.NodeById(1316);
var isIntranet = Homepage.Name.IndexOf("intranet", StringComparison.OrdinalIgnoreCase) > -1;
var nodes = isIntranet ? lawyersRepository.Children.Where("Name.ToLower() = \"" + profileId.ToLower() + "\"") : lawyersRepository.Children.Where("!ProfileIsPrivate && Name.ToLower() = \"" + profileId.ToLower() + "\"");
if(!nodes.Any()){
return;
}
var node = nodes.First();
if (node == null || node.NodeTypeAlias != "LawyerRepositoryItem"){
return;
}
if (node.ProfileIsPrivate && !isIntranet){
return;
}
PageData["PageTitle"] = Model.Name + " - " + node.Name;
SetPageTitle(Model.Name + " - " + node.Name);
var hasContactInfo = (!String.IsNullOrEmpty(node.TelephoneNumber) || !String.IsNullOrEmpty(node.EmailAddress) || !String.IsNullOrEmpty(node.OfficeLocation));
<div class="profile">
<div class="row">
<div class="span4 profile-content">
<h1>@node.Name</h1>
<h3>@node.JobTitle</h3>
@Html.Raw(node.Biography.ToString())
</div>
<div class="span2">
<div class="profile-picture">
@{
if (!node.HasValue("ProfilePictureSquare")){
<img src="/imagegen.ashx?altimage=/images/assets/clear.gif&image=@Library.MediaById(node.ProfilePicture).umbracoFile" alt="@node.Name" />
}
else{
<img src="/imagegen.ashx?altimage=/images/assets/clear.gif&image=@Library.MediaById(node.ProfilePictureSquare).umbracoFile" alt="@node.Name" />
}
}
</div>
<div class="profile-quote">
<!--Tesimonial-->
@RenderPage("~/macroScripts/Widgets/Widget_RandomTestimonial.cshtml", @node.Id.ToString())
</div>
</div>
@if (hasContactInfo)
{
<div class="contact-information">
<div class="pull-left contact-details">
<h4>@Dictionary.ContactInformationHeading</h4>
<dl class="">
@{
if (node.HasValue("TelephoneNumber"))
{
<dd><strong>@Dictionary.Label_TelephoneShort:</strong> @node.TelephoneNumber</dd>
}
if (node.HasValue("EmailAddress"))
{
<dd><strong>@Dictionary.Label_EmailShort:</strong> <a href="mailto:@node.EmailAddress?subject=@Dictionary.DefaultEmailSubjectLine">@node.EmailAddress</a></dd>
}
if (node.HasValue("OfficeLocation"))
{
var officeNode = Library.NodeById(node.OfficeLocation);
<dd><strong>@Dictionary.Label_Office:</strong> <a href="@officeNode.NiceUrl" title="@officeNode.Name">@officeNode.Name</a></dd>
}
}
</dl>
</div>
<div class="pull-left contact-vcard">
<h4>
<a href="/vcard.ashx?contact=@node.Id" title="@Dictionary.DownloadVCard"><i class="t-icon-vcard"></i> <span>@Dictionary.DownloadVCard</span></a></h4>
</div>
</div>
}
@{
var hasSocialMediaUrls = node.HasValue("FacebookUrl") || node.HasValue("TwitterUrl") || node.HasValue("LinkedInUrl") || node.HasValue("YouTubeUrl") || node.HasValue("BlogUrl");
if (hasSocialMediaUrls)
{
<div class="profile-social-links social-links">
<ul class="unstyled">
<li><strong>@Dictionary.Connect</strong></li>
@if (node.HasValue("FacebookUrl"))
{
<li>@GetSocialMediaLink("facebook", node.FacebookUrl, node.Name)</li>
}
@if (node.HasValue("TwitterUrl"))
{
<li>@GetSocialMediaLink("twitter", node.TwitterUrl, node.Name)</li>
}
@if (node.HasValue("LinkedInUrl"))
{
<li>@GetSocialMediaLink("linkedin", node.LinkedInUrl, node.Name)</li>
}
@if (node.HasValue("YouTubeUrl"))
{
<li>@GetSocialMediaLink("youtube", node.YouTubeUrl, node.Name)</li>
}
@if (node.HasValue("BlogUrl"))
{
<li>@GetSocialMediaLink("blogger", node.BlogUrl, node.Name)</li>
}
</ul>
</div>
}
}
</div>
<div class="gold-bar">
<a href="@Dictionary.SubmitTestimonialLink@Dictionary.SubmitTestimonialLinkParameters.Replace("{Name}", node.Name)">@Dictionary.SubmitTestimonialText</a>
</div>
</div>
}
我尝试从备份文件加载,但问题仍然存在。
答案 0 :(得分:6)
您需要找出导致此错误的原因。
如果您在宏中运行并且处于WebForms模式,则可以在URL处添加?umbDebugShowTrace = true(或?umbDebug = true)。 (首先检查web.config中的umbracoDebugMode appsetting是否为真。)
如果这不起作用,请检查App_Data / Logs /文件夹中是否有任何日志文件。你应该在那里看到完整的错误。如果您有旧版本,请检查umbracoLog数据库表。
答案 1 :(得分:0)
最好的办法是查看/App_Data/Logs/UmbracoTraceLog.txt
,它会显示今天记录的日志。
这将揭示错误的根源和完整的堆栈跟踪。