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
– Roberto Cerquetani