Help please!!!!

Jul 18, 2012 at 9:24 PM

Hi

i have a project under MVC RAZOR 2.2.6 and my project is 4.0 framework

i geting error

 

Server Error in '/student' Application.

Operation could destabilize the runtime.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

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

Source Error:

[No relevant source lines]


Source File: GlobalMvcStarter.cs Line: 38

Stack Trace:

[VerificationException: Operation could destabilize the runtime.]
   Dinamico.GlobalMvcStarter.RegisterControllerFactory(ControllerBuilder controllerBuilder, IEngine engine) in GlobalMvcStarter.cs:38
   Dinamico.GlobalMvcStarter.Initialize(IEngine engine) in GlobalMvcStarter.cs:22
   N2.Plugin.InitializerCreatingAttribute.Initialize(IEngine engine) in InitializerCreatingAttribute.cs:23
   N2.Plugin.PluginBootstrapper.InitializePlugins(IEngine engine, IEnumerable`1 plugins) in PluginBootstrapper.cs:87

[PluginInitializationException: While initializing 2 plugin(s) threw an exception. Please review the stack trace to find out what went wrong.

- Operation could destabilize the runtime.

- Exception has been thrown by the target of an invocation.]
   N2.Plugin.PluginBootstrapper.InitializePlugins(IEngine engine, IEnumerable`1 plugins) in PluginBootstrapper.cs:103
   N2.Engine.ContentEngine.Initialize() in ContentEngine.cs:147
   N2.Context.Initialize(Boolean forceRecreate) in Context.cs:42
   N2.Web.InitializerModule.Init(HttpApplication context) in InitializerModule.cs:16
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +431
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +194
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +339
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +253

[HttpException (0x80004005): While initializing 2 plugin(s) threw an exception. Please review the stack trace to find out what went wrong.

- Operation could destabilize the runtime.

- Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8946484
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256

 


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

so any help in that?

thank you in advance

<!-- [VerificationException]: Operation could destabilize the runtime. at Dinamico.GlobalMvcStarter.RegisterControllerFactory(ControllerBuilder controllerBuilder, IEngine engine) in C:\inetpub\wwwroot\Dinamico\GlobalMvcStarter.cs:line 38 at Dinamico.GlobalMvcStarter.Initialize(IEngine engine) in C:\inetpub\wwwroot\Dinamico\GlobalMvcStarter.cs:line 22 at N2.Plugin.InitializerCreatingAttribute.Initialize(IEngine engine) in c:\Downloads\Software\n2cms-n2cms-2.2.6-0-gbbb77f3\n2cms-n2cms-bbb77f3\src\Framework\N2\Plugin\InitializerCreatingAttribute.cs:line 23 at N2.Plugin.PluginBootstrapper.InitializePlugins(IEngine engine, IEnumerable`1 plugins) in c:\Downloads\Software\n2cms-n2cms-2.2.6-0-gbbb77f3\n2cms-n2cms-bbb77f3\src\Framework\N2\Plugin\PluginBootstrapper.cs:line 87 [PluginInitializationException]: While initializing 2 plugin(s) threw an exception. Please review the stack trace to find out what went wrong. - Operation could destabilize the runtime. - Exception has been thrown by the target of an invocation. at N2.Plugin.PluginBootstrapper.InitializePlugins(IEngine engine, IEnumerable`1 plugins) in c:\Downloads\Software\n2cms-n2cms-2.2.6-0-gbbb77f3\n2cms-n2cms-bbb77f3\src\Framework\N2\Plugin\PluginBootstrapper.cs:line 103 at N2.Engine.ContentEngine.Initialize() in c:\Downloads\Software\n2cms-n2cms-2.2.6-0-gbbb77f3\n2cms-n2cms-bbb77f3\src\Framework\N2\Engine\ContentEngine.cs:line 147 at N2.Context.Initialize(Boolean forceRecreate) in c:\Downloads\Software\n2cms-n2cms-2.2.6-0-gbbb77f3\n2cms-n2cms-bbb77f3\src\Framework\N2\Context.cs:line 42 at N2.Web.InitializerModule.Init(HttpApplication context) in c:\Downloads\Software\n2cms-n2cms-2.2.6-0-gbbb77f3\n2cms-n2cms-bbb77f3\src\Framework\N2\Web\InitializerModule.cs:line 16 at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) [HttpException]: While initializing 2 plugin(s) threw an exception. Please review the stack trace to find out what went wrong. - Operation could destabilize the runtime. - Exception has been thrown by the target of an invocation. at System.Web.HttpRuntime.FirstRequestInit(HttpContext context) at System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) -->

Coordinator
Jul 18, 2012 at 10:43 PM

Try turning off medium trust in web.config

I've seen this combining linq and medium trust

Jul 18, 2012 at 11:48 PM

where i can turning OFF?

Jul 19, 2012 at 12:19 AM

i got this message

 

 

Server Error in '/student' Application.

Method N2.Web.Mvc.ViewEnginesExtensions.RegisterThemeViewEngine: type argument 'System.Web.Mvc.RazorViewEngine' violates the constraint of type parameter 'T'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Security.VerificationException: Method N2.Web.Mvc.ViewEnginesExtensions.RegisterThemeViewEngine: type argument 'System.Web.Mvc.RazorViewEngine' violates the constraint of type parameter 'T'.

Source Error:

Line 56: 			viewEngines.RegisterThemeViewEngine<RazorViewEngine>("~/Dinamico/Themes/");
Line 57: 			viewEngines.DecorateViewTemplateRegistration();
Line 58: 		}
Line 59: 	}
Line 60: }


Source File: C:\inetpub\wwwroot\Dinamico\GlobalMvcStarter.cs Line: 58

Stack Trace:

[VerificationException: Method N2.Web.Mvc.ViewEnginesExtensions.RegisterThemeViewEngine: type argument 'System.Web.Mvc.RazorViewEngine' violates the constraint of type parameter 'T'.]
   Dinamico.GlobalMvcStarter.RegisterViewEngines(ViewEngineCollection viewEngines) in C:\inetpub\wwwroot\Dinamico\GlobalMvcStarter.cs:58
   Dinamico.GlobalMvcStarter.Initialize(IEngine engine) in C:\inetpub\wwwroot\Dinamico\GlobalMvcStarter.cs:24
   N2.Plugin.InitializerCreatingAttribute.Initialize(IEngine engine) in c:\Downloads\Software\n2cms-n2cms-2.2.6-0-gbbb77f3\n2cms-n2cms-bbb77f3\src\Framework\N2\Plugin\InitializerCreatingAttribute.cs:23
   N2.Plugin.PluginBootstrapper.InitializePlugins(IEngine engine, IEnumerable`1 plugins) in c:\Downloads\Software\n2cms-n2cms-2.2.6-0-gbbb77f3\n2cms-n2cms-bbb77f3\src\Framework\N2\Plugin\PluginBootstrapper.cs:87

[PluginInitializationException: While initializing 2 plugin(s) threw an exception. Please review the stack trace to find out what went wrong.

- Method N2.Web.Mvc.ViewEnginesExtensions.RegisterThemeViewEngine: type argument 'System.Web.Mvc.RazorViewEngine' violates the constraint of type parameter 'T'.

- Exception has been thrown by the target of an invocation.]
   N2.Plugin.PluginBootstrapper.InitializePlugins(IEngine engine, IEnumerable`1 plugins) in c:\Downloads\Software\n2cms-n2cms-2.2.6-0-gbbb77f3\n2cms-n2cms-bbb77f3\src\Framework\N2\Plugin\PluginBootstrapper.cs:103
   N2.Engine.ContentEngine.Initialize() in c:\Downloads\Software\n2cms-n2cms-2.2.6-0-gbbb77f3\n2cms-n2cms-bbb77f3\src\Framework\N2\Engine\ContentEngine.cs:147
   N2.Context.Initialize(Boolean forceRecreate) in c:\Downloads\Software\n2cms-n2cms-2.2.6-0-gbbb77f3\n2cms-n2cms-bbb77f3\src\Framework\N2\Context.cs:42
   N2.Web.InitializerModule.Init(HttpApplication context) in c:\Downloads\Software\n2cms-n2cms-2.2.6-0-gbbb77f3\n2cms-n2cms-bbb77f3\src\Framework\N2\Web\InitializerModule.cs:16
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +431
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +194
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +339
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +253

[HttpException (0x80004005): While initializing 2 plugin(s) threw an exception. Please review the stack trace to find out what went wrong.

- Method N2.Web.Mvc.ViewEnginesExtensions.RegisterThemeViewEngine: type argument 'System.Web.Mvc.RazorViewEngine' violates the constraint of type parameter 'T'.

- Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8946484
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256



Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

<!-- [VerificationException]: Method N2.Web.Mvc.ViewEnginesExtensions.RegisterThemeViewEngine: type argument 'System.Web.Mvc.RazorViewEngine' violates the constraint of type parameter 'T'. at Dinamico.GlobalMvcStarter.RegisterViewEngines(ViewEngineCollection viewEngines) at Dinamico.GlobalMvcStarter.Initialize(IEngine engine) in C:\inetpub\wwwroot\Dinamico\GlobalMvcStarter.cs:line 24 at N2.Plugin.InitializerCreatingAttribute.Initialize(IEngine engine) in c:\Downloads\Software\n2cms-n2cms-2.2.6-0-gbbb77f3\n2cms-n2cms-bbb77f3\src\Framework\N2\Plugin\InitializerCreatingAttribute.cs:line 23 at N2.Plugin.PluginBootstrapper.InitializePlugins(IEngine engine, IEnumerable`1 plugins) in c:\Downloads\Software\n2cms-n2cms-2.2.6-0-gbbb77f3\n2cms-n2cms-bbb77f3\src\Framework\N2\Plugin\PluginBootstrapper.cs:line 87 [PluginInitializationException]: While initializing 2 plugin(s) threw an exception. Please review the stack trace to find out what went wrong. - Method N2.Web.Mvc.ViewEnginesExtensions.RegisterThemeViewEngine: type argument 'System.Web.Mvc.RazorViewEngine' violates the constraint of type parameter 'T'. - Exception has been thrown by the target of an invocation. at N2.Plugin.PluginBootstrapper.InitializePlugins(IEngine engine, IEnumerable`1 plugins) in c:\Downloads\Software\n2cms-n2cms-2.2.6-0-gbbb77f3\n2cms-n2cms-bbb77f3\src\Framework\N2\Plugin\PluginBootstrapper.cs:line 103 at N2.Engine.ContentEngine.Initialize() in c:\Downloads\Software\n2cms-n2cms-2.2.6-0-gbbb77f3\n2cms-n2cms-bbb77f3\src\Framework\N2\Engine\ContentEngine.cs:line 147 at N2.Context.Initialize(Boolean forceRecreate) in c:\Downloads\Software\n2cms-n2cms-2.2.6-0-gbbb77f3\n2cms-n2cms-bbb77f3\src\Framework\N2\Context.cs:line 42 at N2.Web.InitializerModule.Init(HttpApplication context) in c:\Downloads\Software\n2cms-n2cms-2.2.6-0-gbbb77f3\n2cms-n2cms-bbb77f3\src\Framework\N2\Web\InitializerModule.cs:line 16 at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) [HttpException]: While initializing 2 plugin(s) threw an exception. Please review the stack trace to find out what went wrong. - Method N2.Web.Mvc.ViewEnginesExtensions.RegisterThemeViewEngine: type argument 'System.Web.Mvc.RazorViewEngine' violates the constraint of type parameter 'T'. - Exception has been thrown by the target of an invocation. at System.Web.HttpRuntime.FirstRequestInit(HttpContext context) at System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) -->
Coordinator
Jul 19, 2012 at 11:13 PM

About trust, look for any <trust level="Medium" originUrl=""/> but it can also be locked at the server level.

About the error in the stack trace. This feels like something related to MVC versions and assembly version redirect. Check bindingredirect in web.config for system.web stuff and compare to dll versions.

Jul 20, 2012 at 12:03 AM

you mean my web.config or N2CMS config?

Developer
Jul 20, 2012 at 4:50 PM

trust is set in web.config or machine.config

Jul 21, 2012 at 12:27 PM
Edited Jul 21, 2012 at 12:28 PM

i found the solution by add this code to other web.config

<

 

runtime

>

<

 

assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"

>

<

 

dependentAssembly

>

<

 

assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"

/>

<

 

bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0"

/>

</

 

dependentAssembly

>

</

 

assemblyBinding

>

</

 

runtime

>