2013-08-06 30 views
5

Xin chào khi tải trang trong khi xem trước tôi chưa nạp băng. Bạn có bất kỳ manh mối nào để khắc phục sự cố không?Ngoại lệ kiểm soát băng trong khi xem trước trang

Object reference not set to an instance of an object. 

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. 

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace: 


[NullReferenceException: Object reference not set to an instance of an object.] 
    Sitecore.Data.Database.ApplySecurity(Item[] items) +112 
    Sitecore.Data.Database.SelectItems(String query) +252 
    Sitecore.Shell.Applications.WebEdit.Commands.OpenMyItems.GetHeader(CommandContext context, String header) +188 
    Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderSmallButton(HtmlTextWriter output, Item button, CommandContext commandContext) +307 
    Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderButton(HtmlTextWriter output, Item button, CommandContext commandContext) +732 
    Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderChunk(HtmlTextWriter output, Item chunk, CommandContext commandContext) +330 
    Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderChunk(HtmlTextWriter output, Item chunk, CommandContext commandContext, Boolean isContextual, String id) +204 
    Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderChunk(HtmlTextWriter output, Item chunk, CommandContext commandContext, Boolean isContextual) +242 
    Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderChunks(HtmlTextWriter output, Item strip, CommandContext commandContext, Boolean isContextual) +442 
    Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderStrips(HtmlTextWriter output, Item ribbon, Boolean isContextual, ListString visibleStripList) +800 
    Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderStrips(HtmlTextWriter output, Item defaultRibbon, Item contextualRibbon, ListString visibleStripList) +215 
    Sitecore.Web.UI.WebControls.Ribbons.Ribbon.Render(HtmlTextWriter output) +610 
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +149 
    Sitecore.Web.HtmlUtil.RenderControl(Control ctl) +74 
    Sitecore.Shell.Applications.WebEdit.WebEditRibbonForm.RenderRibbon(Item item) +603 
    Sitecore.Shell.Applications.WebEdit.WebEditRibbonForm.OnLoad(EventArgs e) +1238 

[TargetInvocationException: Exception has been thrown by the target of an invocation.] 
    System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0 
    System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +76 
    System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +193 
    System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +35 
    Sitecore.Web.UI.Sheer.ClientPage.OnLoad(EventArgs e) +337 
    System.Web.UI.Control.LoadRecursive() +71 
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178 

Trả lời

8

Thông tin theo dõi ngăn xếp có vẻ như vấn đề là với nút My Items trong ruy-băng.

enter image description here

Dường như vì một lý do truy vấn nhanh chóng được thực hiện trong khi tải nút này trả về một danh sách các mục có chứa null. Bạn có bất kỳ nhà cung cấp dữ liệu tùy chỉnh nào không?

Có 2 giải pháp mà bạn có thể thử:

  • bộ nhớ cache rõ ràng về /sitecore/admin/cache.aspx trang
  • tìm các mục mà đang gây ra những rắc rối bằng cách chạy truy vấn này như quản trị
Item[] items = Sitecore.Client.ContentDatabase.SelectItems(
    "fast://*[@__lock='%\"full-username-which-experienced-exception-with-domain-name\"%']"); 

Tùy chọn khác là ẩn nút này khỏi ruy băng (trong cơ sở dữ liệu core xóa hoặc thay đổi securit y quyền của /sitecore/content/Applications/WebEdit/Ribbons/WebEdit/Page Editor/Edit/My Items). Theo kinh nghiệm của tôi, nút này hiếm khi được sử dụng ở chế độ Page Editor và có thể làm chậm Page Editor như mọi khi chế độ này được tải, nút My items đếm tất cả các bài viết bị khóa bởi người dùng hiện tại để loại bỏ nó có thể là một ý tưởng hay.

+0

Bạn có thể giải thích cách tôi có thể chạy truy vấn này với tư cách là quản trị viên không? – Alexandr

+0

Tôi sử dụng kết nối MS SQL chuẩn tại cơ sở dữ liệu cục bộ của mình. Cảm ơn. – Alexandr

+1

Mã này có thể được thêm vào bất kỳ trang nào của bạn - chỉ dành cho tùy chọn gỡ lỗi. Không phải là một sự thay đổi vĩnh viễn. Nhớ đặt tên người dùng thích hợp trong truy vấn này. Và đăng nhập với tư cách quản trị viên ** Sitecore **. Nhưng nếu người dùng không sử dụng nút 'Mục của tôi' trong 'Trình chỉnh sửa trang', tôi khuyên bạn nên xóa mục '/ sitecore/content/Applications/WebEdit/Ribbons/WebEdit/Page Editor/Chỉnh sửa/Mục của tôi' khỏi 'lõi 'cơ sở dữ liệu. –

2

Tôi đã gặp sự cố tương tự trong Sitecore 7 trong chế độ chỉnh sửa trang. Tôi cũng đã xác minh lỗi xảy ra khi nhấp vào nút "Mục của tôi" trong trình chỉnh sửa nội dung.

tôi thấy bài này bởi Alex Shyba: http://sitecoreblog.alexshyba.com/2011/11/hidden-gem-of-sitecore-page-editor.html

bài của ông cho thấy việc thiết lập này trong web.config hoặc tốt hơn của bạn bao gồm file:

<setting name="WebEdit.ShowNumberOfLockedItemsOnButton" value="false" /> 

này giải quyết vấn đề trong trình soạn thảo trang cho tôi và sạch sẽ và dễ thực hiện. Hy vọng điều này sẽ giúp bất cứ ai khác đấu tranh với điều này là tốt.

2

Sử dụng 7.1 lỗi này bắt đầu khi tôi khôi phục cơ sở dữ liệu từ bản sao lưu trên máy khác. Tôi đã có thể giải quyết nó bằng cách xây dựng lại chỉ mục tìm kiếm:

Desktop> Control Panel> Databases> Rebuild Index Tìm kiếm

Tôi cũng dọn dẹp cơ sở dữ liệu và xây dựng lại cơ sở dữ liệu liên kết, nhưng những người dường như không sửa nó.

+0

Tôi đã gặp vấn đề tương tự và Rebuild Search Index đã giúp tôi .. Cảm ơn. –