2016-11-20 3 views
0

Я обновил Kentico с версии 8.2 до 9.0. Теперь получим следующую ошибку.System.Data.SqlClient.SqlException: Hint «noexpand» на объекте «View_CMS_Tree_Joined» недействителен

Hint 'noexpand' on object 'View_CMS_Tree_Joined' is invalid. 

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.Data.SqlClient.SqlException: Hint 'noexpand' on object 'View_CMS_Tree_Joined' is invalid. 

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: 


[SqlException (0x80131904): Hint 'noexpand' on object 'View_CMS_Tree_Joined' is invalid.] 
    System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +392 
    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +815 
    System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4515 
    System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +61 
    System.Data.SqlClient.SqlDataReader.get_MetaData() +138 
    System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +6738869 
    System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) +6741487 
    System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +586 
    System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +107 
    System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +288 
    System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +180 
    System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +21 
    System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +325 
    System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +420 
    System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +278 
    CMS.DataEngine.AbstractDataConnection.ExecuteQuery(String queryText, QueryDataParameters queryParams, QueryTypeEnum queryType, Boolean requiresTransaction) +261 

[Exception: 
[DataConnection.HandleError]: 

Query: 
SELECT [NodeAliasPath], [DocumentURLPath], [NodeID], [DocumentCulture] 
FROM View_CMS_Tree_Joined AS V WITH (NOLOCK, NOEXPAND) LEFT OUTER JOIN COM_SKU AS S WITH (NOLOCK) ON V.NodeSKUID = S.SKUID 
WHERE (NodeSiteID = 1) AND ([DocumentURLPath] LIKE @DocumentURLPath OR [DocumentURLPath] LIKE @DocumentURLPath1) 

Caused exception: 
Hint 'noexpand' on object 'View_CMS_Tree_Joined' is invalid. 
] 
    CMS.DataEngine.AbstractDataConnection.HandleError(String queryText, Exception ex) +181 
    CMS.DataEngine.AbstractDataConnection.ExecuteQuery(String queryText, QueryDataParameters queryParams, QueryTypeEnum queryType, Boolean requiresTransaction) +776 
    CMS.DataEngine.GeneralConnection.RunQuery(QueryParameters query) +383 
    CMS.DataEngine.GeneralConnection.ExecuteQuery(QueryParameters query) +401 
    CMS.DataEngine.GeneralConnection.ExecuteQuery(QueryParameters query, Int32& totalRecords) +75 
    CMS.DataEngine.DataQueryBase`1.GetDataFromDBInternal() +143 
    CMS.DataEngine.DataQueryBase`1.GetDataFromDB() +96 
    CMS.DataEngine.DataQueryBase`1.GetData() +149 
    CMS.DataEngine.DataQueryBase`1.get_Result() +114 
    CMS.DataEngine.ObjectQueryBase`2.GetResults(IDataQuery query, Int32& totalRecords) +41 
    CMS.DataEngine.DataQueryBase`1.GetDataFromDB() +128 
    CMS.DocumentEngine.DocumentQueryBase`2.<GetDataFromDB>b__2() +9 
    CMS.DocumentEngine.DocumentQueryProperties.GetDataInternal(IDocumentQuery query, Func`1 baseGetDataMethod, Action`1 setTotalRecords) +91 
    CMS.DataEngine.DataQueryBase`1.GetData() +149 
    CMS.DataEngine.ObjectQueryBase`2.GetData() +273 
    CMS.DocumentEngine.DocumentQueryBase`2.GetData() +171 
    CMS.DataEngine.DataQueryBase`1.get_Result() +114 
    CMS.DataEngine.DataQueryBase`1.GetResults(IDataQuery query, Int32& totalRecords) +32 
    CMS.DataEngine.DataQueryBase`1.GetDataFromDB() +128 
    CMS.DocumentEngine.MultiDocumentQueryBase`3.<GetDataFromDB>b__2() +9 
    CMS.DocumentEngine.DocumentQueryProperties.GetDataInternal(IDocumentQuery query, Func`1 baseGetDataMethod, Action`1 setTotalRecords) +91 
    CMS.DataEngine.DataQueryBase`1.GetData() +149 
    CMS.DataEngine.DataQueryBase`1.get_Result() +114 
    CMS.URLRewritingEngine.CMSDocumentRouteHelper.RegisterDocumentRoutes(String where, String siteName, List`1 routes) +525 
    CMS.URLRewritingEngine.CMSDocumentRouteHelper.RegisterRoutes(String siteName) +206 
    CMS.URLRewritingEngine.CMSDocumentRouteHelper.EnsureRoutes(String siteName) +252 
    CMS.URLRewritingEngine.URLRewritingHandlers.AuthorizeRequest(Object sender, EventArgs e) +271 
    CMS.Base.AbstractHandler.CallEventHandler(EventHandler`1 h, TArgs e) +117 
    CMS.Base.AbstractHandler.Raise(String partName, List`1 list, TArgs e, Boolean important) +826 
    CMS.Base.SimpleHandler`2.RaiseExecute(TArgs e) +142 
    CMS.Base.SimpleHandler`2.RaiseExecute(TArgs e) +214 
    CMS.Base.SimpleHandler`2.StartEvent(TArgs e) +300 
    System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165 

ответ

0

В Kentico 9 View_CMS_Tree_Joined индексируется, но в Kentico 8 это не так. Поэтому вам нужно проверить, что это представление имеет индексы. Если нет, попробуйте создать их:

SET ARITHABORT ON 
SET CONCAT_NULL_YIELDS_NULL ON 
SET QUOTED_IDENTIFIER ON 
SET ANSI_NULLS ON 
SET ANSI_PADDING ON 
SET ANSI_WARNINGS ON 
SET NUMERIC_ROUNDABORT OFF 

GO 

/****** Object: Index IX_View_CMS_Tree_Joined_ClassName_NodeSiteID_DocumentForeignKeyValue_DocumentCulture] ******/ 

CREATE NONCLUSTERED INDEX [IX_View_CMS_Tree_Joined_ClassName_NodeSiteID_DocumentForeignKeyValue_DocumentCulture] ON [dbo].[View_CMS_Tree_Joined] 
(
[ClassName] ASC, 
[NodeSiteID] ASC, 
[DocumentForeignKeyValue] ASC, 
[DocumentCulture] ASC 
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] 
GO 

CREATE UNIQUE CLUSTERED INDEX [IX_View_CMS_Tree_Joined_NodeSiteID_DocumentCulture_NodeID] ON [dbo].[View_CMS_Tree_Joined] 
(
[NodeSiteID] ASC, 
[DocumentCulture] ASC, 
[NodeID] ASC 
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] 
GO