无法在本地 运行 Kentico 解决方案

Unable to run a Kentico Solution locally

情况: 我正在处理最近从 Kentico 8.2 更新到 Kentico 9,然后从 Kentico 9 更新到 Kentico 10 的网站。根据升级日志,所有升级都成功,但是,Kentico SmartSearch 在升级后不再起作用错误: "Error loading the WebPart 'SearchBox' of type 'SearchBox'".

Objective: 我的 objective 是在本地机器上创建实时网站的开发副本,这样我就可以解决问题并在本地进行测试,但我不确定如何完成。

问题: 我已经从实时网站上请求了文件夹、解决方案和数据库的精确克隆,我已经将数据库导入到我的 sql 服务器,然后我在 Visual Studio 2017 社区上打开了解决方案版本,更新了 CMSConnectionString 以匹配新的数据库路径,我尝试构建解决方案,我通过更新引用名称修复了一些错误,删除了过时的引用名称,此时解决方案构建没有错误,但是我无法在我的本地机器上实现它 运行 ,每当我尝试在我的本地机器上 运行 它时,我都会遇到以下异常:

 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.]
 CMS.URLRewritingEngine.URLRewriter.RewriteUrl(String relativePath, 
 ExcludedSystemEnum excludedEnum, SiteNameOnDemand siteName, 
 ViewModeOnDemand viewMode) +2387
 CMS.URLRewritingEngine.URLRewriter.RewriteUrl(RequestStatusEnum status, 
 String relativePath, ExcludedSystemEnum excludedEnum) +61
 CMS.URLRewritingEngine.URLRewritingHandlers.RewriteUrl(Object sender, 
 EventArgs e) +50
 CMS.Base.AbstractHandler.CallEventHandler(EventHandler'1 h, TArgs e) +100
 CMS.Base.AbstractHandler.Raise(String partName, List'1 list, TArgs e, 
 Boolean important) +714
 CMS.Base.SimpleHandler'2.RaiseExecute(TArgs e) +100
 CMS.Base.SimpleHandler'2.RaiseExecute(TArgs e) +143
 CMS.Base.SimpleHandler'2.StartEvent(TArgs e) +217
 CMS.Base.ApplicationModule.PostResolveRequestCache(Object sender, EventArgs 
 e) +16
 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep 
.Execute() +201
  System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +132
 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& 
completedSynchronously) +73

检查 IIS 日志后:

我检查了 IIS 事件日志,当我尝试 运行 网站 2 事件发生时,我认为这是由于代表我的一些配置错误,但我不能完全弄清楚缺少什么所以以下是事件查看器中的以下项目

1 - 信息:

 Event code: 4005 
 Event message: Forms authentication failed for the request. Reason: The ticket supplied was invalid. 
 Event time: 6/8/2018 11:13:12 AM 
 Event time (UTC): 6/8/2018 10:13:12 AM 
 Event ID: 75f3f8236cca48e0b7d9156a7f648fc1 
 Event sequence: 2 
 Event occurrence: 1 
 Event detail code: 50201 

Application information: 
  Application domain: /LM/W3SVC/1/ROOT/Kentico10-1-131729263846745120 
  Trust level: Full 
  Application Virtual Path: /Kentico10 
  Application Path: C:\inetpub\wwwroot\Kentico10\CMS\ 
  Machine name: FAKENAME
Process information: 
  Process ID: 1392 
  Process name: w3wp.exe 
  Account name: FAKEDOMAIN\Jony.Bimbinz 

Request information: 
  Request URL: http://localhost/Kentico10 
  Request path: /Kentico10 
  User host address: ::1 
  User:  
  Is authenticated: False 
  Authentication Type:  
  Thread account name: FAKEDOMAIN\Jony.Bimbinz 

Name to authenticate:  

Custom event details: 

2 - 警告(与原始异常相同):

 Event code: 3005     
 Event message: An unhandled exception has occurred.     
 Event time: 6/8/2018 11:54:58 AM     
 Event time (UTC): 6/8/2018 10:54:58 AM     
 Event ID: b16d590261134c3c9b988bdb01a24b73    
 Event sequence: 4     
 Event occurrence: 1     
 Event detail code: 0

Application information: 
    Application domain: /LM/W3SVC/1/ROOT/Kentico10-1-131729288917669454 
    Trust level: Full 
    Application Virtual Path: /Kentico10 
    Application Path: C:\inetpub\wwwroot\Kentico10\CMS\ 
    Machine name: FAKENAME 

Process information: 
    Process ID: 9336 
    Process name: w3wp.exe 
    Account name: FAKEDOMAIN\Jony.Bimbinz

Exception information: 
    Exception type: NullReferenceException 
    Exception message: Object reference not set to an instance of an object.
   at CMS.URLRewritingEngine.URLRewriter.RewriteUrl(String relativePath, ExcludedSystemEnum excludedEnum, SiteNameOnDemand siteName, ViewModeOnDemand viewMode)
   at CMS.URLRewritingEngine.URLRewriter.RewriteUrl(RequestStatusEnum status, String relativePath, ExcludedSystemEnum excludedEnum)
   at CMS.URLRewritingEngine.URLRewritingHandlers.RewriteUrl(Object sender, EventArgs e)
   at CMS.Base.AbstractHandler.CallEventHandler[TArgs](EventHandler'1 h, TArgs e)
   at CMS.Base.AbstractHandler.Raise[TArgs](String partName, List'1 list, TArgs e, Boolean important)
   at CMS.Base.SimpleHandler'2.RaiseExecute(TArgs e)
   at CMS.Base.SimpleHandler'2.RaiseExecute(TArgs e)
   at CMS.Base.SimpleHandler'2.StartEvent(TArgs e)
   at CMS.Base.ApplicationModule.PostResolveRequestCache(Object sender, EventArgs e)
   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)



  Request information: 
    Request URL: http://localhost/Kentico10 
    Request path: /Kentico10 
    User host address: ::1 
    User:  
    Is authenticated: False 
    Authentication Type:  
    Thread account name: FAKEDOMAIN\Joao.Ferreira 

Thread information: 
    Thread ID: 10 
    Thread account name: FAKEDOMAIN\Jony.Bimbinz
    Is impersonating: False 
    Stack trace:    at CMS.URLRewritingEngine.URLRewriter.RewriteUrl(String relativePath, ExcludedSystemEnum excludedEnum, SiteNameOnDemand siteName, ViewModeOnDemand viewMode)
   at CMS.URLRewritingEngine.URLRewriter.RewriteUrl(RequestStatusEnum status, String relativePath, ExcludedSystemEnum excludedEnum)
   at CMS.URLRewritingEngine.URLRewritingHandlers.RewriteUrl(Object sender, EventArgs e)
   at CMS.Base.AbstractHandler.CallEventHandler[TArgs](EventHandler'1 h, TArgs e)
   at CMS.Base.AbstractHandler.Raise[TArgs](String partName, List'1 list, TArgs e, Boolean important)
   at CMS.Base.SimpleHandler'2.RaiseExecute(TArgs e)
   at CMS.Base.SimpleHandler'2.RaiseExecute(TArgs e)
   at CMS.Base.SimpleHandler'2.StartEvent(TArgs e)
   at CMS.Base.ApplicationModule.PostResolveRequestCache(Object sender, EventArgs e)
   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


Custom event details:

如果您不能 运行 管理员,您可能需要检查本地主机是否在您的 table CMS_LicenseKey 中,如果没有,请在 table 具有与生产相同的数据,并将 licensedomain 更改为 localhost。可能还有另一个 table 涉及但我不确定?

主要问题 主要问题是由于站点应用程序中的区域性设置不正确,默认区域性的母版页也丢失,因此当默认路径“/”被命中时抛出异常。

"Forms authentication failed for the request. Reason: The ticket supplied was invalid." 异常也有问题,我能够通过在 IIS 中生成新的 machineKey 并使用它编辑 web.config 文件来解决这个问题。

解决方案: 在与 Kentico 支持交换一些电子邮件后,我被建议从 SSL 缩减以在 http:// 上获取站点 运行(即使 CMS 设置强制使用 https),所以我这样做了,我编辑了 web.config 文件:

<httpCookies httpOnlyCookies="true" requireSSL="false" />

并更改了 IIS 设置以允许 http。

从那时起,我终于能够登录管理页面,不再抛出无效网站错误,并且我能够:

  • 在站点应用程序中将域更改为本地主机。
  • 更改站点应用程序中的默认文化。
  • 已将母版页复制并发布到正确的区域性中。

现在网站已经 运行 了,我仍然对一些样式表有一些问题,但我相信这些与这个问题无关。

我要感谢所有试图提供帮助的人,特别感谢现场的 Kentico 支持人员!