WebAPI OData 5.0 Beta: el acceso a GlobalConfiguration produce un error de seguridad
Recientemente instalé la versión de prelanzamiento del marco OData 5.0 de WebApi para jugar con el nuevo soporte $ expand. Todo está bien, pero tengo una excepción extraña en App_Start.
Attempt by security transparent method
'System.Web.Http.GlobalConfiguration.get_Configuration()'
to access security critical type 'System.Web.Http.HttpConfiguration' failed.
Error de fuente:
Line 12: protected void Application_Start()
Line 13: {
Line 14: WebApiConfig.Register(GlobalConfiguration.Configuration); // <--
Line 15: }
Traza de la pila:
[TypeAccessException: Attempt by security transparent method 'System.Web.Http.GlobalConfiguration.get_Configuration()' to access
security critical type 'System.Web.Http.HttpConfiguration' failed.]
System.Web.Http.GlobalConfiguration.get_Configuration() +0
API.WebApiApplication.Application_Start() in Global.asax.cs:14
[HttpException (0x80004005): Attempt by security transparent method 'System.Web.Http.GlobalConfiguration.get_Configuration()' to access
security critical type 'System.Web.Http.HttpConfiguration' failed.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +12863325
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +175
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475
[HttpException (0x80004005): Attempt by security transparent method 'System.Web.Http.GlobalConfiguration.get_Configuration()' to access
security critical type 'System.Web.Http.HttpConfiguration' failed.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12880068
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12721257
Google revela muy poco.