Pregunta

I'm trying to deploy a website and I'm getting the following error :

Request for ConfigurationPermission failed while attempting to access configuration section 'system.web/globalization'. To allow all callers to access the data for this section, set section attribute 'requirePermission' equal 'false' in the configuration file where this section is declared. ---> System.Security.SecurityException: Request for the permission of type 'System.Configuration.ConfigurationPermission, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.

The problem is that I haven't even defined that section in my webconfig file. Therefore I tried to define it as follow :

1) I added this code at the bottom of my webconfig file (just before the closing configuration tag)

<globalization
           fileEncoding="utf-8"
           requestEncoding="utf-8"
           responseEncoding="utf-8"
           culture="fr-FR"
           uiCulture="fr-FR"
        />

2) I added this code in the section part of the file :

<configSections>
<section type="System.Web.Configuration.GlobalizationSection, System.Web.Globalization" name="globalization" requirePermission="false" />
</configSections>

But it's still not working. I'm on a shared hosting plan so I can't change the trust level of my application. I'm not very skilled with webconfig, I made some researchs on msdn and google to come up with this solution. But unfortunately I'm still getting the same error. Any idea ?

Update: I noticed that in many examples the PublicKeyToken, VersionNumber etc.. are written in the type attribute. I'll try to find the correct informations for the assembly I'm using. Well, I added more details about the assembly but it didn't work :

<section type="System.Web.Configuration.GlobalizationSection, System.Web, Version=4.0.0.0, Culture=neutral,  PublicKeyToken=b03f5f7f11d50a3a " allowDefinition="Everywhere" name="globalization" requirePermission="false" />
¿Fue útil?

Solución

During the past three years I’ve developed this project you are the second person to ever ask for medium trust, so I’ll have to give the same answer as I did the last time.

Piranha CMS have never been validated for medium trust, the reason for this is simple. Usually, at least with all of the shared hosting providers I have ever worked with, medium trust is primarily used form ASP.NET 1.0-3.5. I haven’t come across anyone that actually uses medium trust for .NET 4.0-4.5. If you google a bit you’ll see that even Microsoft considers medium trust to be obsolete, for example:

Is trying to develop for Medium Trust a lost cause?

My suggestion is to switch hosting provider, as this will be much more cost efficient than to spend time investigating what’s causing the error. If you for some reason HAVE to stay within medium trust you’ll have to debug it locally against the source code. If you find any changes that needs to be made you can always send a pull request back to the repo to have them included.

But please note that we do not test for medium trust, so we can not guarantee that future releases will be compatible with medium trust either.

Regards

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top