Base solution for your next web application
Open Closed

Web.Config Trust Level - Deployment problem? #1716


User avatar
0
hugol created

Hi there,

When I run or deploy/publish my website to my local servers everything works fine but when I publish the site to my Winhost account I get the following problem: Server Error in '/Test_PlaygroundPrj' Application. Inheritance security rules violated while overriding member: 'Castle.MicroKernel.DefaultKernel.InitializeLifetimeService()'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.

In order to sort this I have to add the following entry to the web.config

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

Note: Any level below (High, Medium...) will throw the same error.

From MSDN: "FULL" Specifies unrestricted permissions. Grants the ASP.NET application permissions to access any resource that is subject to operating system security. All privileged operations are supported. [https://msdn.microsoft.com/en-us/library/tkscy493%28v=vs.85%29.aspx])

Any ideas? comments? feedback? Is this the correct approach to sort the problem. I can give you access to the server if you would like since this is just a playground account and project for testing purposes.

========== Full LOG ========== Server Error in '/Test_PlaygroundPrj' Application.

Inheritance security rules violated while overriding member: 'Castle.MicroKernel.DefaultKernel.InitializeLifetimeService()'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.

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.TypeLoadException: Inheritance security rules violated while overriding member: 'Castle.MicroKernel.DefaultKernel.InitializeLifetimeService()'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.

Source Error: [No relevant source lines]

Source File: f:\tempdir\v4.0.30319\test_playgroundprj\a65af6ea\76786a49\App_global.asax.k0nvxyo6.0.cs Line: 0

Stack Trace: [TypeLoadException: Inheritance security rules violated while overriding member: 'Castle.MicroKernel.DefaultKernel.InitializeLifetimeService()'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.] Castle.Windsor.WindsorContainer..ctor() +0 Abp.Dependency.IocManager..ctor() +44 Abp.Dependency.IocManager..cctor() +30

[TypeInitializationException: The type initializer for 'Abp.Dependency.IocManager' threw an exception.] Mood2Success.Test_PlaygroundPrj.Web.MvcApplication..ctor() +53 ASP.global_asax..ctor() in f:\tempdir\v4.0.30319\test_playgroundprj\a65af6ea\76786a49\App_global.asax.k0nvxyo6.0.cs:0

[TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +113 System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +206 System.Activator.CreateInstance(Type type, Boolean nonPublic) +83 System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1065 System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +124 System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +20 System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +60 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +263 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9946024 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +90 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261


4 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I have also searched on the internet for this. I couldn't find any other solution than yours. It might be related to virtual machine which you are hosting your site.

  • User Avatar
    0
    hugol created

    Usually when you host it on a provider it's the other way around. I mean, they only allow "High" or "Medium" as the maximum security level.

    I will run some other tests today and I will post the results here for future reference.

    Thanks,

  • User Avatar
    0
    moustafa created

    Actually i have the same problem with the same host provider winhost did you fix it ?

  • User Avatar
    0
    hugol created

    <cite>moustafa: </cite> Actually i have the same problem with the same host provider winhost did you fix it ?

    I think this is related to the fact that you probably have MVC site deployed to your main domain and you are trying to deploy a another MVC site to a subdomain. Or even if it's your main site.

    If you add the following entry to the web.config you will be able to run the site (main domain or sub domain) <system.web> <trust level="Full"/>

    You can play with "High" and "Medium" and see if you can sort out the problem.