我正在嘗試將Facebook的評論數添加到我的網站。我正在使用Facebook評論插件,並希望在我的按鈕內輸出當前計數。但是,我收到了來自Razor的解析器錯誤。出於某種原因,Razor正在將結束標記解釋爲C#代碼。Razor解析一些我不想分析的東西。 「解析器錯誤」
'/'應用程序中的服務器錯誤。
分析器錯誤
說明:該請求提供服務所需資源的分析過程中發生錯誤。請檢查以下特定的分析錯誤詳細信息並適當修改您的源文件。
Parser Error Message: Encountered end tag "div" with no matching start tag.
Are your start/end tags properly balanced?
Source Error:
Line 42: </div>
Line 43: </div>
Line 44: </div>
Line 45: }
Source File: /Views/Home/Index.cshtml Line: 44
Version Information: Microsoft .NET Framework
Version:4.0.30319; ASP.NET Version:4.0.30319.225
這是我的觀點:
@using asdf.WebUI.Helpers
@model IEnumerable<asdf.WebUI.Models.PostModel>
@{
ViewBag.Title = String.Format("adsf - {0}", DynamicContentHelper.GetDynamicHomePageQuip());
}
@foreach (var post in Model)
{
<div class="post">
<a href="@Url.Action("Details", "Post", new { id = post.PostId })">
<img class="post-img" src="@post.ImageUrl" alt="@post.Description" title="@post.Description" />
</a>
<div class="detail">
<div class="information">
<h3 class="score">PUNTAJE: <span>234</span></h3>
<div class="vote">
<button type="button" class="btn btn-success"><i class="icon-thumbs-up icon-white"></i> ME GUSTA</button>
<button type="button" class="btn btn-danger"><i class="icon-thumbs-down icon-white"></i> NO ME GUSTA</button>
<a class="btn btn-info comment-link" href="@Url.Action("Details", "Post", new { id = post.PostId })">
<-- ERROR FIRES HERE!!!! -->
<i class="icon-comment icon-white"></i> COMENTARIOS <fb:comments-count href="http://asdf.net/bolivia/"/></fb:comments-count>
</a>
</div>
<div class="post-description">
<blockquote class="pull-right">
<p>@post.Description</p>
<small>imagen subida por: <a href="@Url.Action("Details", "Post", new { id = post.PostId })">@post.UserName</a></small>
</blockquote>
</div>
</div>
<div class="social">
<a href="#" id="shareFacebook" data-popup-height="380" data-popup-width="660" data-url="http://www.facebook.com/sharer.php?u=http://www.asdf.net/bolivia/@post.PostId">
<img src="@Url.Content("~/Public/assets/images/FB-share.png")"/>
</a>
<a href="#" id="shareTwitter" data-popup-height="270" data-popup-width="600" data-url="http://twitter.com/intent/tweet?url=http://www.asdf.net/bolivia/@post.PostId&[email protected]">
<img src="@Url.Content("~/Public/assets/images/TW-share.png")"/>
</a>
</div>
</div>
</div>
}
http://stackoverflow.com/替換此
a/9795370/1182982這可能有幫助 – Yasser
'/> fb:comments-count>'<---你有一個額外的/ – Matthew
@Matthew你應該作爲答案張貼; *就是*答案 –