SgDotNet
Singapore Professional .NET User Group -For Cool Developers

Medium Trust Security Ploicy

rated by 0 users
This post has 2 Replies | 1 Follower

Top 500 Contributor
Posts 3
praveeav Posted: 12-10-2007 7:29 PM

 I am  using Datawindow.net 2.0[Trail] in VS2005 with ASP.Net 2.0 & C#.Net . Using WebDatawindow.net in ASP.Net data retrieving and also
data interting are so smoth . We using connection ADO.net & ASP.Net security trust level default security level ( full trust level )

For security problem most of developer suggests that 'medium trust'and also our webserver support only medium trust.So we are changing Security policy to 'medium'.
 ( In %windir%\Microsoft.NET\Framework\v2.0.50727\CONFIG\Web.Config
     to change
 <trust level="Full" originUrl="" /> to <trust level="Medium" originUrl="" />
 )

 ***********Then I am  facing a crucial problem  ************
 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.

How can overcome to in this problem . If you  have any solution ... pls ............

praveeav@rediffmail.com 
    

Top 500 Contributor
Posts 3
praveeav Posted: 12-24-2007 1:14 PM

Hi ,

We are using one of the third party tool ( Datawindow.net) in Project ASP.Net with C# . The server (IIS) configured to work in

Medium Trust Security Ploicy .

Changing Trust Level , is following method.

( In %windir%\Microsoft.NET\Framework\v2.0.50727\CONFIG\Web.Config
     to change
 <trust level="Full" originUrl="" /> to <trust level="Medium" originUrl="" />
 )

In runtime an error  occured . 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.

  

How can customise trust level permission ..  , U have solution about it pls replay ....

Erro details :

Server Error in '/Accounts' Application.

Server Error in '/Accounts' 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) +2737813
   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 'DataWindowInterop, Version=2.0.6684.0, Culture=neutral, PublicKeyToken=cc0f66dd9541b3da' 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.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +211
   System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +141
   System.Reflection.Assembly.Load(String assemblyString) +25
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +98

[ConfigurationErrorsException: Could not load file or assembly 'DataWindowInterop, Version=2.0.6684.0, Culture=neutral, PublicKeyToken=cc0f66dd9541b3da' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +725
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +297
   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +71
   System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +39
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +203
   System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +95
   System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) +879
   System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) +198
   System.Web.Compilation.BuildManager.CompileCodeDirectories() +368
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +402

[HttpException (0x80004005): Could not load file or assembly 'DataWindowInterop, Version=2.0.6684.0, Culture=neutral, PublicKeyToken=cc0f66dd9541b3da' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
   System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +81
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +524
   System.Web.Compilation.BuildManager.CallAppInitializeMethod() +27
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +560

[HttpException (0x80004005): Could not load file or assembly 'DataWindowInterop, Version=2.0.6684.0, Culture=neutral, PublicKeyToken=cc0f66dd9541b3da' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +645
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +151
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +314


Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.213


Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.213


Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.213

Top 500 Contributor
Posts 3

Hi ..,

We are using one of the third part tool (Syabse DataWindow.Net 2.5 trail version )
in ASP.Net with C#.Net .

 Server (IIS) securityPolicy  trustLevel  is "Medium".
 We configure Server following method
  (
  In %windir%\Microsoft.NET\Framework\v2.0.50727\CONFIG\Web.Config
     to change
 <trust level="Full" originUrl="" /> to <trust level="Medium" originUrl="" />
  )

 In project  compilation time an error occured ie :
 
 Error 1 Could not load file or assembly 'DataWindowInterop,
 Version=2.5.0.0, Culture=neutral, PublicKeyToken=cc0f66dd9541b3da'
 or one of its dependencies. Failed to grant minimum permission requests.
 (Exception from HRESULT: 0x80131417) .


 In server is  full trust security level , No compilation error .  

 We using Web.config structure as like

 <compilation debug="true">
   <assemblies>
    <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Drawing.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="Microsoft.VisualC, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="Sybase.DataWindow.WebService.Runtime, Version=2.5.0.0, Culture=neutral, PublicKeyToken=CC0F66DD9541B3DA"/>
    <add assembly="Sybase.DataWindow.Db, Version=2.5.0.0, Culture=neutral, PublicKeyToken=CC0F66DD9541B3DA"/></assemblies></compilation>

How can overcome this error , U have any idea about it ,
Pls.. replay

Top 10 Contributor
Posts 2,260
The DataWindow.NET assembly has code that performs activities that are not allowed in Medium Trust configuration. It has to be run in a higher-level Trust setting if it is to fulfill its duties. You should consult DataWindow developement team what is the minimum Trust level they need for the code/assembly to run.

The melody of logic will always play out the truth. ~ Narumi Ayumu, Spiral

Page 1 of 1 (4 items) | RSS
Copyright SgDotNet 2004-2008
Powered by Community Server (Commercial Edition), by Telligent Systems