Breaking error in integration/dev branch

Topics: General, Installing Orchard, Troubleshooting, Writing modules
Developer
Mar 28, 2011 at 2:09 PM

Recent changes introduced a breaking error:

Attempt by security transparent method 'Orchard.Web.MvcApplication.Application_Start()' to access security critical method 'Orchard.Startup.Starter.LaunchStartupThread(System.Action`1<Autofac.ContainerBuilder>)' failed.

It totally breaks the current dev/1.x/integration build. It started happening when startup logic was relocated to separate assembly. That introduced raising a security-related exception in .NET Framework 4. I found a workaround to this (adding assembly attribute to Orchard.Startup - [assembly: AllowPartiallyTrustedCallers]), which solves the problem though.

Anyone noticed that? This bug is here for couple of days...

Full stack trace:

Stack Trace:
[MethodAccessException: Attempt by security transparent method 'Orchard.Web.MvcApplication.Application_Start()' to access security critical method 'Orchard.Startup.Starter.LaunchStartupThread(System.Action`1<Autofac.ContainerBuilder>)' failed.]
   Orchard.Web.MvcApplication.Application_Start() in d:\Orchard.Clean\src\Orchard.Web\Global.asax.cs:20

[HttpException (0x80004005): Attempt by security transparent method 'Orchard.Web.MvcApplication.Application_Start()' to access security critical method 'Orchard.Startup.Starter.LaunchStartupThread(System.Action`1<Autofac.ContainerBuilder>)' failed.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +3988565
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +325
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375

[HttpException (0x80004005): Attempt by security transparent method 'Orchard.Web.MvcApplication.Application_Start()' to access security critical method 'Orchard.Startup.Starter.LaunchStartupThread(System.Action`1<Autofac.ContainerBuilder>)' failed.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11529072
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4784373
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

Cheers!

Mar 28, 2011 at 2:59 PM

I saw this error when I tried to switch to Full trust. Everything still seems to work in Medium trust.

Developer
Mar 28, 2011 at 3:08 PM

Exactly, thanks for clarification as I forgot to add that:) I'm running Orchard in full trust on dedicated server.

Mar 28, 2011 at 3:24 PM

Also running on a dedi. I wanted to switch to Full trust to see if it reduced the volume of exceptions and improved performance. Unfortunately denied at this stage :)

Coordinator
Mar 29, 2011 at 7:31 AM

If this still reproduces with the latest bits, please file a bug.

Apr 2, 2011 at 8:57 PM
Edited Apr 3, 2011 at 8:15 AM

To reproduce it just run Orchard/build/Stage under IIS Express.

With

  <system.web>
   <trust level="Medium"/>
  </system.web>

it works but with "Full" not.