gpt4 book ai didi

visual-studio-2010 - 在sitecore中跟踪NullReferenceExceptions

转载 作者:行者123 更新时间:2023-12-04 13:34:02 26 4
gpt4 key购买 nike

我正在尝试跟踪在加载任何网页时显示在sitecore 6.5上的NullReferenceException:

[NullReferenceException: Object reference not set to an instance of an object.]
Sitecore.Diagnostics.Log.Error(String message, Exception exception, Type ownerType) +133
Sitecore.Diagnostics.Log.Error(String message, Type ownerType) +45
Sitecore.Configuration.Factory.LoadAutoIncludeFiles(ConfigPatcher patcher, String folder) +680
Sitecore.Configuration.Factory.LoadAutoIncludeFiles(XmlNode element) +63
Sitecore.Configuration.Factory.GetConfiguration() +347
Sitecore.Diagnostics.LoggerFactory..cctor() +67

[TypeInitializationException: The type initializer for 'Sitecore.Diagnostics.LoggerFactory' threw an exception.]
Sitecore.Diagnostics.LoggerFactory.GetLogger(Type type) +17
Sitecore.Diagnostics.Log.Error(String message, Exception exception, Type ownerType) +93
Sitecore.Diagnostics.Log.Error(String message, Type ownerType) +45
Sitecore.Configuration.Factory.LoadAutoIncludeFiles(ConfigPatcher patcher, String folder) +680
Sitecore.Configuration.Factory.LoadAutoIncludeFiles(XmlNode element) +63
Sitecore.Configuration.Factory.GetConfiguration() +347
Sitecore.Configuration.Factory.GetConfigNode(String xpath, Boolean assert) +82
Sitecore.Configuration.Factory.GetConfigNode(String xpath) +29
Sitecore.Resources.Media.UploadWatcher.InitializeIgnoreList() +114
Sitecore.Resources.Media.UploadWatcher..cctor() +51

[TypeInitializationException: The type initializer for 'Sitecore.Resources.Media.UploadWatcher' threw an exception.]
Sitecore.Resources.Media.UploadWatcher..ctor() +0

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +98
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +241
System.Activator.CreateInstance(Type type, Boolean nonPublic) +69
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1136
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +111
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +23
System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +60
System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +231
System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +1365
Microsoft.Web.Infrastructure.DynamicModuleHelper.DynamicModuleReflectionUtil.GetIntegratedModuleCollection(HttpApplication target, IntPtr appContext) +33
Microsoft.Web.Infrastructure.DynamicModuleHelper.CriticalStatics.Init(HttpApplication context) +179
Microsoft.Web.Infrastructure.DynamicModuleHelper.IntegratedDynamicModule.Init(HttpApplication context) +6
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +517
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +194
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +339
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +253

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9087676
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256

使该错误难以跟踪的有趣特征如下:

1)我在sitecore日志中收到以下错误:
Exception: System.InvalidOperationException
Message: 'analytics' connection string is not defined
Source: Sitecore.Kernel
at Sitecore.Diagnostics.Assert.IsNotNull(Object value, String message)
at Sitecore.Diagnostics.Assert.ResultNotNull[T](T result, String message)
at Sitecore.Analytics.Data.DataAccess.DataAdapters.DataAdapterManager.ConnectionStrings.get_AnalyticsSettings()
at Sitecore.Analytics.Data.DataAccess.DataAdapters.DataAdapterManager.ConnectionStrings.get_Analytics()
at Sitecore.Analytics.Data.DataAccess.DataAdapters.Sql.SqlServer.SqlServerDataAdapterProvider..ctor()

但是,分析功能非常禁用:
<setting name="Analytics.DisableDatabase" value="true" />
...
<setting name="Analytics.Enabled" value="false" />

2) 当我使用Visual Studio调试,附加到IIS并击中至少一个断点时,错误消失了(如果我没有击中任何断点,则错误仍然存​​在)

3)当我做一个构建,或触摸web.config时,错误再次出现。尚未尝试重建,因为这将从网站/bin中删除重要的sitecore dll

有关我的环境的更多信息:Visual Studio 2010,IIS 7,sitecore 6.5,Windows 7

您将如何跟踪此错误?

最佳答案

在经过半天的调试和反编译之后,好了,我发现问题出在(内部)类Sitecore.Configuration.ConfigPatcher,它似乎与用于内容交付和内容创作环境的Sitecore.WebDav.config文件的xdt转换的Sitecore.WebDav.[Debug/Release].config文件有关。 。

目前,解决方法是重命名这些文件(并禁用xdt转换)

但是,此问题应影响非web.config文件的xdt转换的任何用户(我使用的是慢速猎豹加载项)

关于visual-studio-2010 - 在sitecore中跟踪NullReferenceExceptions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9587257/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com