Orchard 1.5.1 and ASP.NET 4.5

Topics: Core, Troubleshooting
Aug 20, 2012 at 12:38 PM

Hi,

My hosting provider has upgrader their servers to ASP.NET 4.5 and now none of my Orchard sites work.

It is an issue on Orchard 1.1.30.

I get the following error:

Stack Trace:

[VerificationException: Operation could destabilize the runtime.]
   Orchard.ContentManagement.Handlers.ActivatingFilter`1..ctor(String[] contentTypes) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\ContentManagement\Handlers\ActivatingFilter.cs:17
   Orchard.Roles.Handlers.UserRolesPartHandler..ctor(IRepository`1 userRolesRepository) +85

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +190
   Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +115
   Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +213
   Autofac.Core.Resolving.ComponentActivation.Activate(IEnumerable`1 parameters) +48
   Autofac.Core.Resolving.<>c__DisplayClass1.<Execute>b__0() +12
   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +112
   Autofac.Core.Resolving.ComponentActivation.Execute(IEnumerable`1 parameters) +188
   Autofac.Core.Resolving.ResolveOperation.Resolve(ISharingLifetimeScope activationScope, IComponentRegistration registration, IEnumerable`1 parameters) +176
   Autofac.Core.Resolving.ComponentActivation.Resolve(IComponentRegistration registration, IEnumerable`1 parameters) +24
   Autofac.Features.Collections.<>c__DisplayClass6.<RegistrationsFor>b__1(IComponentRegistration cr) +17
   System.Linq.WhereSelectArrayIterator`2.MoveNext() +66
   System.Linq.Buffer`1..ctor(IEnumerable`1 source) +335
   System.Linq.Enumerable.ToArray(IEnumerable`1 source) +77
   Autofac.Features.Collections.<>c__DisplayClass4.<RegistrationsFor>b__0(IComponentContext c, IEnumerable`1 p) +138
   Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +62
   Autofac.Core.Resolving.ComponentActivation.Activate(IEnumerable`1 parameters) +48
   Autofac.Core.Resolving.ComponentActivation.Execute(IEnumerable`1 parameters) +97
   Autofac.Core.Resolving.ResolveOperation.Resolve(ISharingLifetimeScope activationScope, IComponentRegistration registration, IEnumerable`1 parameters) +176
   Autofac.Core.Resolving.ComponentActivation.Resolve(IComponentRegistration registration, IEnumerable`1 parameters) +24
   Autofac.Core.Registration.<>c__DisplayClass5.<RegistrationsFor>b__2(IComponentContext c, IEnumerable`1 p) +19
   Autofac.Builder.<>c__DisplayClass1`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p) +14
   Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +62
   Autofac.Core.Resolving.ComponentActivation.Activate(IEnumerable`1 parameters) +48
   Autofac.Core.Resolving.ComponentActivation.Execute(IEnumerable`1 parameters) +97
   Autofac.Core.Resolving.ResolveOperation.Resolve(ISharingLifetimeScope activationScope, IComponentRegistration registration, IEnumerable`1 parameters) +176
   Autofac.Core.Lifetime.LifetimeScope.Resolve(IComponentRegistration registration, IEnumerable`1 parameters) +98
   Autofac.ResolutionExtensions.TryResolve(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) +70
   Autofac.ResolutionExtensions.Resolve(IComponentContext context, Service service, IEnumerable`1 parameters) +87
   Autofac.ResolutionExtensions.Resolve(IComponentContext context, IEnumerable`1 parameters) +118
   Orchard.ContentManagement.DefaultContentManager.New(String contentType) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\ContentManagement\DefaultContentManager.cs:77
   Orchard.ContentManagement.DefaultContentManager.Get(Int32 id, VersionOptions options) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\ContentManagement\DefaultContentManager.cs:139
   Orchard.ContentManagement.DefaultContentQuery.<Slice>b__0(ContentItemVersionRecord x) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\ContentManagement\DefaultContentQuery.cs:141
   System.Linq.WhereSelectListIterator`2.MoveNext() +104
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +381
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +58
   Orchard.ContentManagement.DefaultContentQuery.Slice(Int32 skip, Int32 count) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\ContentManagement\DefaultContentQuery.cs:139
   Orchard.ContentManagement.ContentQuery`1.Orchard.ContentManagement.IContentQuery<T>.Slice(Int32 skip, Int32 count) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\ContentManagement\DefaultContentQuery.cs:188
   Orchard.Core.Settings.Services.SiteService.<GetSiteSettings>b__0(AcquireContext`1 ctx) in d:\TeamCity\Projects\Orchard-Default\src\Orchard.Web\Core\Settings\Services\SiteService.cs:30
   Orchard.Caching.Cache`2.CreateEntry(TKey k, Func`2 acquire) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Caching\Cache.cs:41
   Orchard.Caching.<>c__DisplayClass3.<Get>b__0(TKey k) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Caching\Cache.cs:17
   System.Collections.Concurrent.ConcurrentDictionary`2.AddOrUpdate(TKey key, Func`2 addValueFactory, Func`3 updateValueFactory) +125
   Orchard.Caching.Cache`2.Get(TKey key, Func`2 acquire) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Caching\Cache.cs:15
   Orchard.Caching.DefaultCacheManager.Get(TKey key, Func`2 acquire) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Caching\DefaultCacheManager.cs:33
   Orchard.Core.Settings.Services.SiteService.GetSiteSettings() in d:\TeamCity\Projects\Orchard-Default\src\Orchard.Web\Core\Settings\Services\SiteService.cs:29
   Orchard.Settings.CurrentSiteWorkContext.Get(String name) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Settings\CurrentSiteWorkContext.cs:13
   Orchard.Environment.<>c__DisplayClass7`1.<FindResolverForState>b__2(IWorkContextStateProvider wcsp) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\WorkContextImplementation.cs:32
   System.Linq.WhereSelectArrayIterator`2.MoveNext() +66
   System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source, Func`2 predicate) +161
   Orchard.Environment.WorkContextImplementation.FindResolverForState(String name) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\WorkContextImplementation.cs:32
   System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +72
   Orchard.Environment.WorkContextImplementation.GetState(String name) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\WorkContextImplementation.cs:27
   Orchard.WorkContext.get_CurrentSite() in d:\TeamCity\Projects\Orchard-Default\src\Orchard\WorkContext.cs:25
   Orchard.Themes.Services.SiteThemeSelector.GetTheme(RequestContext context) +21
   Orchard.Themes.<>c__DisplayClass5.<GetRequestTheme>b__0(IThemeSelector x) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Themes\ThemeManager.cs:20
   System.Linq.WhereSelectArrayIterator`2.MoveNext() +66
   System.Linq.WhereEnumerableIterator`1.MoveNext() +152
   System.Linq.Buffer`1..ctor(IEnumerable`1 source) +216
   System.Linq.<GetEnumerator>d__0.MoveNext() +110
   System.Linq.Enumerable.Count(IEnumerable`1 source) +4081813
   Orchard.Themes.ThemeManager.GetRequestTheme(RequestContext requestContext) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Themes\ThemeManager.cs:24
   Orchard.Mvc.ViewEngines.ThemeAwareness.ThemedViewResultFilter.OnResultExecuting(ResultExecutingContext filterContext) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Mvc\ViewEngines\ThemeAwareness\ThemedViewResultFilter.cs:29
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +41
   System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +177
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +324
   System.Web.Mvc.Controller.ExecuteCore() +106
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +91
   System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
   System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +34
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +19
   System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +10
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +48
   System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   Orchard.Mvc.Routes.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Mvc\Routes\ShellRoute.cs:148
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9629708
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
Aug 22, 2012 at 9:55 AM

Hi

Sorry to hear you are having this problem. Can you confirm that you are running 1.5.1, or 1.1?

Thanks!

 

Steve.

Aug 28, 2012 at 6:29 AM

Hi Steve,

I tried to upgrade from 1.1 to 1.5.1.

The upgrade guide does not work, as you get the above error after trying.

I had to "manually" upgrade all my sites, which - needless to say - was a pain.

Karsten

Aug 28, 2012 at 10:48 AM

Hi Karsten

Thanks for the info. I was trying to work out whether it was 1.5 that suffered from the error. Now I know.

I'm having the "same" error with 1.4, except that it's in the Vandelay.Favicon part handler's constructor, which is up-to-date.

Sorry to hear that the upgrade path didn't work for you. Admittedly, it's a big leap from 1.1 to 1.5. But I had the same problem going from 1.3 to 1.4 -- had to restart from scratch.

Looks like I'll have to try upgrading to 1.5 manually too -- my 1.4 installation is hosed by the latest MSFT upgrades.

Thanks again.

Cheers,
Steve.

Sep 18, 2012 at 10:11 AM

Hi,

I have been running 1.4 without issues but all of a sudden my site(s) are no longer working based on the same error above:

System.Security.VerificationException: Operation could destabilize the runtime.

Filters.Add(new ActivatingFilter<WarmupSettingsPart>("Site"));

Locally the site runs fine but my hosting provider is having issues in resolving the problem the site(s) have now been down for a number of days and I need to get them working ASAP.

My suggestion to them is that they have obviously made some server changes as I have not altered the site code. Suggested that they may have installed .NET 4.5 as my investigations have all led me down this path.

I could take time to upgrade to 1.5 but I don't want to do this without knowing for certain that this will solve the issues as currently my time is a little limited?

Thanks
Mark

Sep 18, 2012 at 11:56 AM

Hi Mark,

I did a manual upgrade of all my own sites to 1.5.1. It was a lot of hassle and I lost some of the blog entries, but it did solve the problem.

Karsten 

Oct 6, 2012 at 12:05 PM

I started to get the same exception yesterday with a website running on Orchard 1.4.0.0. It obviously started to happen after some updates to the server (i'm using a shared hosting), but these morons from technical support do claim, that they did not change anything.

For testing purposes, I've deployed a clean Orchard 1.5.1 package on the server, and it works fine. So, hope to migrate my website to 1.5.1 today ;)

Coordinator
Oct 8, 2012 at 7:32 PM

To solve this issue you might need to enable Full Trust AND add this property to the main project's Assembly info, and maybe to every modules (TBD): 

[SecurityRules ... ,SkipVerificationInFullTrust=true]

Also if you run 1.4.2 then there shouldn't be any issue.

Coordinator
Oct 11, 2012 at 6:09 PM

If a previous version of Orchard doesn't work anymore with .NET 4.5, then you need to do a Windows Update, or apply those patches directly, on your server or on your hosting provider, depending on where Orchard is running:

For Win8
http://blogs.msdn.com/b/b8/archive/2012/10/09/updating-windows-8-for-general-availability.aspx

For x86

http://go.microsoft.com/fwlink/?LinkID=267766&clcid=0x409

For x64

http://go.microsoft.com/fwlink/?LinkID=267886&clcid=0x409

Nov 17, 2012 at 11:18 PM

For those finding this answer on a search or a link from another thread, take note that all of those Windows Updates appear to be for Windows 8, Windows Server 2012 and another Windows 8 product.