在ASP.NET Web API(5.2.3.0)项目中,我将其包含在控制器属性中:
Faulting application name: Profiler.exe, version: 2017.140.17254.0, time stamp: 0x5ae98b94
Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0xc0000005
Fault offset: 0x75bb48cb
Faulting process id: 0x4e0
Faulting application start time: 0x01d42da026f3a3d9
Faulting application path: C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\Profiler.exe
Faulting module path: unknown
Report Id: 652f0139-9993-11e8-9f5b-327e82b70454
并间歇性地失败,但有以下异常:
public class ControllerConfigAttribute : Attribute, IControllerConfiguration
{
public void Initialize(HttpControllerSettings settings, HttpControllerDescriptor descriptor)
{
settings.Formatters.XmlFormatter.UseXmlSerializer = true;
settings.Formatters.XmlFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue(MediaTypeNames.Text.Plain));
settings.Formatters.XmlFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue(MediaTypeNames.Application.Xml));
settings.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue(MediaTypeNames.Application.Json));
}
}
没有对System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Collections.Generic.List`1.Insert(Int32 index, T item)
at System.Net.Http.Formatting.MediaTypeFormatter.MediaTypeHeaderValueCollection.InsertItem(Int32 index, MediaTypeHeaderValue item)
at System.Collections.ObjectModel.Collection`1.Add(T item)
at MyControllers.ControllerConfigAttribute.Initialize(HttpControllerSettings settings, HttpControllerDescriptor descriptor)
at System.Web.Http.Controllers.HttpControllerDescriptor.InvokeAttributesOnControllerType(HttpControllerDescriptor controllerDescriptor, Type type)
at System.Web.Http.Controllers.HttpControllerDescriptor.InvokeAttributesOnControllerType(HttpControllerDescriptor controllerDescriptor, Type type)
at System.Web.Http.Controllers.HttpControllerDescriptor.Initialize()
at System.Web.Http.Controllers.HttpControllerDescriptor..ctor(HttpConfiguration configuration, String controllerName, Type controllerType)
at System.Web.Http.Dispatcher.DefaultHttpControllerSelector.InitializeControllerInfoCache()
集合进行显式修改的应用程序中的其他位置。
是什么原因造成的?
某种线程安全/并发问题?