iis - 无法在本地运行 Kentico 解决方案
问题描述
情况:我正在研究一个最近从 Kentico 8.2 更新到 Kentico 9,然后从 Kentico 9 到 Kentico 10 的网站。根据升级日志,所有升级都成功,但是,Kentico SmartSearch 在升级错误:“加载‘SearchBox’类型的 WebPart‘SearchBox’时出错”。
目标:我的目标是在我的本地机器上创建实时网站的开发副本,以便我可以解决问题并在本地进行测试,但我不确定如何实现。
问题:我已要求从实时网站准确克隆文件夹、解决方案和数据库,我已将数据库导入我的 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:
解决方案
主要问题 主要问题是由于站点应用程序中的文化设置不正确,默认文化的母版页也丢失了,因此当默认路径“/”被点击时抛出异常。
“请求的表单身份验证失败。原因:提供的票证无效”也存在问题。异常,我能够通过在 IIS 中生成新的 machineKey 并使用它编辑 web.config 文件来解决此问题。
解决方案: 在与 Kentico 支持人员交换了一些电子邮件后,我被建议从 SSL 缩减以使站点在 http:// 上运行(即使 CMS 设置强制使用 https),所以我这样做了,我编辑了 web.config文件:
<httpCookies httpOnlyCookies="true" requireSSL="false" />
并已更改 IIS 设置以允许 http。
从那时起,我终于能够登录到管理页面,该页面不再抛出无效网站错误,并且我能够:
- 在站点应用程序中将域更改为 localhost。
- 更改站点应用程序中的默认区域性。
- 将母版页复制并发布到正确的文化中。
现在该网站正在正常运行,我仍然对一些样式表有一些问题,但我相信这些与这个问题无关。
我要感谢所有试图提供帮助的人,特别是现场的 Kentico 支持!