Trustlevel error

Asked

Viewed 907 times

0

My application hosted on Ocaweb has the following error:

Server Error in '/' Application.

Required Permissions cannot be acquired.

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.Policy.Policyexception: Required Permissions cannot be acquired.

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:

[Policyexception: Required Permissions cannot be acquired.]
System.Security.Securitymanager.Resolvepolicy(Evidence Evidence, Permissionset reqdPset, Permissionset optPset, Permissionset denyPset, Permissionset & denied, Boolean checkExecutionPermission) +7613027
System.Security.Securitymanager.Resolvepolicy(Evidence Evidence, Permissionset reqdPset, Permissionset optPset, Permissionset denyPset, Permissionset& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission) +57

[Fileloadexception: Could not load file or Assembly 'System.Web.Datavisualization, Version=3.5.0.0, Culture=neutral, Publickeytoken=31bf3856ad364e35' or one of its dependencies. Failed to Grant minimum permission requests. (Exception from HRESULT: 0x80131417)] System.Reflection.Assembly. _nLoad(Assemblyname filename, String codebase, Evidence assemblySecurity, Assembly locationHint, Stackcrawlmark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
System.Reflection.Assembly.nLoad(Assemblyname filename, String codebase, Evidence assemblySecurity, Assembly locationHint, Stackcrawlmark & stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +43
System.Reflection.Assembly.Internalload(Assemblyname assemblyRef, Evidence assemblySecurity, Stackcrawlmark& stackMark, Boolean forIntrospection) +127
System.Reflection.Assembly.Internalload(String assemblyString, Evidence assemblySecurity, Stackcrawlmark& stackMark, Boolean forIntrospection) +142 System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.Loadassemblyhelper(String assemblyName, Boolean starDirective) +46

[Configurationerrorsexception: Could not load file or Assembly 'System.Web.Datavisualization, Version=3.5.0.0, Culture=neutral, Publickeytoken=31bf3856ad364e35' or one of its dependencies. Failed to Grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
System.Web.Configuration.CompilationSection.Loadassemblyhelper(String assemblyName, Boolean starDirective) +613
System.Web.Configuration.CompilationSection.Loadallassembliesfromappdomainbindirectory() +203 System.Web.Configuration.CompilationSection.Loadassembly(Assemblyinfo ai) +105
System.Web.Compilation.BuildManager.Getreferencedassemblies(Compilationsection compConfig) +178
System.Web.Compilation.BuildProvidersCompiler.. ctor(Virtualpath configPath, Boolean supportLocalization, String outputAssemblyName) +54 System.Web.Compilation.ApplicationBuildProvider.Getglobalasaxbuildresult(Boolean isPrecompiledApp) +227
System.Web.Compilation.BuildManager.Compileglobalasax() +52
System.Web.Compilation.BuildManager.Ensuretoplevelfilescompiled() +337

[Httpexception (0x80004005): Could not load file or Assembly 'System.Web.Datavisualization, Version=3.5.0.0, Culture=neutral, Publickeytoken=31bf3856ad364e35' or one of its dependencies. Failed to Grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
System.Web.Compilation.BuildManager.Reporttoplevelcompilationexception() +58 System.Web.Compilation.BuildManager.Ensuretoplevelfilescompiled() +512 System.Web.Hosting.HostingEnvironment.Initialize(Applicationmanager appManager, Iapplicationhost appHost, Iconfigmappathfactory configMapPathFactory, Hostingenvironmentparameters hostingParameters) +729

[Httpexception (0x80004005): Could not load file or Assembly 'System.Web.Datavisualization, Version=3.5.0.0, Culture=neutral, Publickeytoken=31bf3856ad364e35' or one of its dependencies. Failed to Grant minimum permission requests. (Exception from HRESULT: 0x80131417)] System.Web.Httpruntime.Firstrequestinit(Httpcontext context) +8979171
System.Web.Httpruntime.Ensurefirstrequestinit(Httpcontext context) +85 System.Web.Httpruntime.Processrequestinternal(Httpworkerrequest Wr) +259

They say that I should change my application to Mediumtrustlevel but do not offer any support for such a change just talking to the programmer. While researching a little more about, I found several other cases equal but no solution, but all suggest the following change in web config.

Error:

Server Error in '/' Application.

Configuration Error

Description: An error occurred During the Processing of a Configuration file required to service this request. Please review the specific error Details Below and Modify your Configuration file appropriately.

Parser Error Message: This Configuration Section cannot be used at this path. This Happens when the site Administrator has locked access to this Section using from an inherited Configuration file.

Attempts that return the above error:

Web.config

1.

<system.web>
Line 38:     <trust level="Medium" originUrl="" />
Line 39:        <!--
Line 40:             Set compilation debug="true" to insert debugging

2.

Line 38:    <location allowOverride="true">
Line 39:        <system.web>
Line 40:            <securityPolicy>
Line 41:                <trust level="Medium" />
Line 42:            </securityPolicy>

3.

Line 38:    <location allowOverride="false">
Line 39:        <system.web>
Line 40:            <securityPolicy>
Line 41:                <trustLevel name="Medium" policyFile="internal" />
Line 42:            </securityPolicy>
  • Rodrigo, I had the same problem in Ocaweb. It seems that some dll s from . net 3.5 are not compatible with medium trust, also tried to change medium trust settings without success, I believe it is blocked, I migrated my application to the . net 4.0 solved. Hug

2 answers

1

Rodrigo, this same problem happened to me. I created an application where I used Ioc with Ninject, but for Ninject to work, the application cannot be configured as Mediumtrust, the non-Locaweb of Fulltrust support. I solved the problem by changing hosting. If you want, I can inform which hosting server I migrated to. I found it much better than Ocaweb.

1


Honestly there’s not much to do if you’re staying at Locaweb.

If your site is still in an early stage of development you can set up on your Web.Config the trust level for medium, which is basically what you found in your searches, however this will not solve the problem, this will only give you at development time the same limitations that Locaweb is imposing.

What this helps you is that you will find out what works and what doesn’t before you send it to Ocaweb, but you can expect a lot of frustration, many of the modern technologies don’t work in medium trust, so no ASP.Net MVC, Entity Framework and probably most (if not all) of Ioc frameworks.

If it is a site that was already running and stopped now due to the change then we are in the same boat, I had a system years running in Ocaweb without problems and from one day to the next it stopped working due to this change, and it was something without any warning, simply changed and only when I complained that I learned of their policy change, so they returned to full trust and gave me 10 days to fix the problem, after that they would return to medium trust.

So I must say that I used these 10 days very well to solve all the problems with Ocaweb, basically coming out of it, because in 10 days it would be impossible to change a site that already worked for almost 10 years.

If someone asked me about hosting a year ago I would have no doubt in indicating the Ocaweb, today I say to stay away from the Ocaweb.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.