Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Fredrik Sewén 39 posts 106 karma points
    Feb 09, 2011 @ 11:42
    Fredrik Sewén
    0

    Umbraco 4.5.2 in medium trust - reflection issue

    Hi,

    I have a problem installing Umbraco in a medium trust envirionment (Loopia Sweden). I get an error message complaining about ReflectionPermissions.

    As I understand Umbraco 4.5.2 should run in medium trust, right?

    What I did was:

    1. Change setting umbracoUseMediumTrust to true
    2. I couldn't uncomment <trust level="Medium" originUrl=".*" /> because overriding the trust level is not allowed
    3. Added <identity impersonate="true" /> because I read somewhere that you were supposed to do this (although it's the same without it)

    There seems something is happening because when accessing default.aspx I get redirected to /install/default.aspx?redir=true&url=/default.aspx

    But with error message:

    Server Error in '/' Application.

    Security Exception

    Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

    Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


    Stack Trace:

    [SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
    System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) +150
    System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) +100
    System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action, Boolean throwException) +284
    System.Security.PermissionSetTriple.CheckSetDemand(PermissionSet demandSet, PermissionSet& alteredDemandset, RuntimeMethodHandle rmh) +69
    System.Security.PermissionListSet.CheckSetDemand(PermissionSet pset, RuntimeMethodHandle rmh) +150
    System.Security.PermissionListSet.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet) +30
    System.Threading.CompressedStack.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet) +40
    System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant, CompressedStack securityContext) +123
    System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant) +54



    Version Information: Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3618

    Please help,

    /Fredrik

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Feb 09, 2011 @ 12:34
    Tim
    0

    Hiya,

    Have a look at this post, at the answer from Ben H that's marked as the solution. He mentions some setting that you might need to change, does doing that sort out the problem?

  • Fredrik Sewén 39 posts 106 karma points
    Feb 09, 2011 @ 12:38
    Fredrik Sewén
    0

    Hi Tim,

    I can't see the link to the post?

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Feb 09, 2011 @ 13:14
  • Fredrik Sewén 39 posts 106 karma points
    Feb 09, 2011 @ 13:38
    Fredrik Sewén
    0

    Thanks for the link Tim, 

    Unfortunately requirePermission is already set to false in the Umbraco 4.5.2 for .NET 3.5 release so that doesn't help. Forgot to say that i Use .NET 3.5.

     

    <section name="clientDependency" type="ClientDependency.Core.Config.ClientDependencySection, ClientDependency.Core" requirePermission="false"/>
    <section name="Examine" type="Examine.Config.ExamineSettings, Examine" requirePermission="false"/>
    <section name="ExamineLuceneIndexSets" type="UmbracoExamine.Config.ExamineLuceneIndexes, UmbracoExamine" requirePermission="false"/>

    I talked to the provider and they say that Umbraco demands support for reflection, which they do not support. But to my knowledge reflection is part of the Medium Trust by default, so Umbraco should support that if it supports Medium trust?

     

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Feb 09, 2011 @ 14:27
    Douglas Robar
    0

    Medium trust isn't a problem with Umbraco 4.5.2, though many hosts run in a custom trust environment based on medium trust (perhaps that's true of your host?).

    In any event, not all packages are medium-trust friendly. My ImageGen package, for instance, is not yet medium trust capable.

    When do you get the errors, when visiting the website itself, logging into umbraco, viewing a specific page in the Umbraco admin interface, ???

     

    Another option - copy the site locally and set IIS to medium trust. Does it work then? If so then it is a setting with your host and not Umbraco.

    cheers,
    doug.

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Feb 09, 2011 @ 14:47
    Tim
    0

    What @Doug said. Although the host may support medium trust, they may customise the bits they do and don't support. I know a few hosts that won't let you use reflection, so it might just be that they're running a version of medium trust with reflection disabled. Try setting up a site in medium trusty locally as Doug suggests, and if that works, its definitely the host.

  • Fredrik Sewén 39 posts 106 karma points
    Feb 09, 2011 @ 14:52
    Fredrik Sewén
    0

    Hi Doug,

    According to my provider they are running Medium Trust and they are allowing:

    1. OleDbPermission
    2. OdbcPermission
    3. WebPermission
    4. file access to the ftp folder
    5. SocketPermission
    6. A version of Connector.Net

    I believe just as you are saying that it is a problem with the provider.I'm using a fresh installation of Umbraco, without any packages. I get this error just as I reach the site. This is from Firebug Net-console:

    So what does the error message mean?

    SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

    The more I know, the easier it will be for me to talk to the provider.

    And also. When it comes to reflection. To my knowledge you cannot use reflection in Medium Trust. Am I wrong?

    "Medium trust applications have no registry access, no event log access, and no ability to use reflection" from http://msdn.microsoft.com/en-us/library/ff648344.aspx

     

  • Fredrik Sewén 39 posts 106 karma points
    Feb 09, 2011 @ 16:45
    Fredrik Sewén
    0

    Do anyone know how to see which assembly trying to request System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ?

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Feb 09, 2011 @ 16:48
    Douglas Robar
    0

    Any chance you get an event log entry with a full trace? 

    cheers,
    doug.

  • Fredrik Sewén 39 posts 106 karma points
    Feb 09, 2011 @ 17:25
    Fredrik Sewén
    0

    Thanks Doug! I'll send an email and ask them

    /Fredrik

  • Fredrik Sewén 39 posts 106 karma points
    Feb 10, 2011 @ 15:26
    Fredrik Sewén
    0

    Thanks for all your help,

    I asked provider to  for logs. They wouldn't give me. It ended up me getting my money back and moving to another provider.

    For now the conclusion is that you cannot install Umbraco 4.5.2 on Loopia (Sweden).

    Thanks again for your effort,

    Cheers

    /Fredrik

Please Sign in or register to post replies

Write your reply to:

Draft