Moh*_*yam 5 sitecore sitecore8
将我的站点从7.1升级到8.1后,在expierence分析中删除任何页面时出现以下错误消息:
"由于服务器错误,无法显示'图表名称'图表.请与系统管理员联系."
以下调用在浏览器控制台上显示500错误:
我检查了日志文件,那里没有记录服务器错误!
更多信息:
错误消息:"ValueFactory尝试访问此实例的Value属性."
也
" at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at System.Web.Http.Dispatcher.DefaultHttpControllerSelector.GetControllerMapping() at System.Web.Http.Routing.AttributeRoutingMapper.AddRouteEntries(SubRouteCollection collector, HttpConfiguration configuration, IInlineConstraintResolver constraintResolver, IDirectRouteProvider directRouteProvider) at System.Web.Http.Routing.AttributeRoutingMapper.<>c__DisplayClass2.<>c__DisplayClass4.<MapAttributeRoutes>b__1() at System.Web.Http.Routing.RouteCollectionRoute.EnsureInitialized(Func`1 initializer) at System.Web.Http.Routing.AttributeRoutingMapper.<>c__DisplayClass2.<MapAttributeRoutes>b__0(HttpConfiguration config) at System.Web.Http.HttpConfiguration.ApplyControllerSettings(HttpControllerSettings settings, HttpConfiguration configuration) at System.Web.Http.Controllers.HttpControllerDescriptor.InvokeAttributesOnControllerType(HttpControllerDescriptor controllerDescriptor, Type type) at System.Web.Http.Controllers.HttpControllerDescriptor..ctor(HttpConfiguration configuration, String controllerName, Type controllerType) at System.Web.Http.Dispatcher.DefaultHttpControllerSelector.InitializeControllerInfoCache() at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at System.Web.Http.Dispatcher.DefaultHttpControllerSelector.GetControllerMapping() at System.Web.Http.Routing.AttributeRoutingMapper.AddRouteEntries(SubRouteCollection collector, HttpConfiguration configuration, IInlineConstraintResolver constraintResolver, IDirectRouteProvider directRouteProvider)
at System.Web.Http.Routing.AttributeRoutingMapper.<>c__DisplayClass2.<>c__DisplayClass4.<MapAttributeRoutes>b__1() at System.Web.Http.Routing.RouteCollectionRoute.EnsureInitialized(Func`1 initializer) at System.Web.Http.Routing.AttributeRoutingMapper.<>c__DisplayClass2.<MapAttributeRoutes>b__0(HttpConfiguration config) at
System.Web.Http.HttpConfiguration.ApplyControllerSettings(HttpControllerSettings settings, HttpConfiguration configuration) at
System.Web.Http.Controllers.HttpControllerDescriptor.InvokeAttributesOnControllerType(HttpControllerDescriptor controllerDescriptor, Type type) at
System.Web.Http.Controllers.HttpControllerDescriptor..ctor(HttpConfiguration configuration, String controllerName, Type controllerType) at
Sitecore.Services.Infrastructure.Web.Http.Dispatcher.NamespaceHttpControllerSelector.InitializeControllerDictionary() at System.Lazy`1.CreateValue()--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Lazy`1.get_Value() at Sitecore.Services.Infrastructure.Web.Http.Dispatcher.NamespaceHttpControllerSelector.FindMatchingController(String namespaceName, String controllerName) at Sitecore.Services.Infrastructure.Web.Http.Dispatcher.NamespaceHttpControllerSelector.SelectController(HttpRequestMessage request) at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
Sitecore 支持提供了此问题的原因和解决方案,并认为会添加它,以防其他人发生同样的问题:
原因:
该问题似乎是由 Web API 配置冲突引起的
据我所知,在应用程序启动期间执行以下代码:
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
System.Web.Http.GlobalConfiguration.Configure(MyDll.WebApiConfig.Register);
}
Run Code Online (Sandbox Code Playgroud)
解决方案:
作为替代方法,可以将此代码移至“初始化”管道以在应用程序启动时运行。
如果自定义代码在默认 Sitecore.ExperienceAnalytics.Api.Pipelines.Initialize.WebApiInitializer 处理器之后运行,则将首先加载 Experience Analytics 配置。
例如: 1)创建“初始化”管道处理器
internal class WebApiInitializer
{
public void Process(PipelineArgs args)
{
System.Web.Http.GlobalConfiguration.Configure(Register);
}
public static void Register(HttpConfiguration config)
{
config.MapHttpAttributeRoutes();
}
}
Run Code Online (Sandbox Code Playgroud)
2) 创建一个配置文件并将其放入 Include/Z.MapRoutes fodler 中(这样它将最后加载):
<configuration xmlns:x="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<initialize>
<processor type="HttpAttributeRouting.WebApiInitializer, HttpAttributeRouting" x:after="processor[position()=last()]" />
</initialize>
</pipelines>
</sitecore>
</configuration>
Run Code Online (Sandbox Code Playgroud)