From: Ben on
Hi,
I wrote a C# application that is using the Data Access Application Block
Enterprise Library, Jan 2006.
When i'm running the application on my local machine everything works fine.
The problem occur when i'm trying to run the application from a remote
computer using shortcut, i get the following error:

System.TypeInitializationException: The type initializer for
'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory'
threw an exception. ---> System.IO.FileLoadException: Could not load file or
assembly 'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to
grant minimum permission requests. (Exception from HRESULT: 0x80131417)
File name: 'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0,
Culture=neutral, PublicKeyToken=null' --->
System.Security.Policy.PolicyException: Required permissions cannot be
acquired.
at System.Security.SecurityManager.ResolvePolicy(Evidence evidence,
PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset,
PermissionSet& denied, Boolean checkExecutionPermission)
at System.Security.SecurityManager.ResolvePolicy(Evidence evidence,
PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset,
PermissionSet& denied, Int32& securitySpecialFlags, Boolean
checkExecutionPermission)
at
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory..cctor()
--- End of inner exception stack trace ---
at
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp[T](String
id, IConfigurationSource configurationSource)
at
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.NameTypeFactoryBase`1.Create(String name)
at
Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase(String name)


Any help is welcome. Thanks!
Ben

From: Marc Gravell on
Sounds like you don't trust the remote location (network apps run in more of
a sandbox by default); in 2.0 I would suggest using ClickOnce, signing the
manifest and specifying an appropriate trust level; otherwise you can use
caspol or the configuration wizard (in the start menu, or there is an MMC
plugin), and specify a runtime security policy based e.g. on the network
path (url?) or signature of the app you want to run.

Marc


From: Nicholas Paldino [.NET/C# MVP] on
Ben,

When you are running an application from a remote computer, it does not
run with full trust. You will have to launch the application from your
local computer or go to the .NET Framework Administration tool and configure
the framework to grant your assembly the permissions you require.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- mvp(a)spam.guard.caspershouse.com

"Ben" <Ben(a)discussions.microsoft.com> wrote in message
news:75AD0E50-A13E-4B87-A83A-E86442B9F31F(a)microsoft.com...
> Hi,
> I wrote a C# application that is using the Data Access Application Block
> Enterprise Library, Jan 2006.
> When i'm running the application on my local machine everything works
> fine.
> The problem occur when i'm trying to run the application from a remote
> computer using shortcut, i get the following error:
>
> System.TypeInitializationException: The type initializer for
> 'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory'
> threw an exception. ---> System.IO.FileLoadException: Could not load file
> or
> assembly 'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0,
> Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed
> to
> grant minimum permission requests. (Exception from HRESULT: 0x80131417)
> File name: 'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0,
> Culture=neutral, PublicKeyToken=null' --->
> System.Security.Policy.PolicyException: Required permissions cannot be
> acquired.
> at System.Security.SecurityManager.ResolvePolicy(Evidence evidence,
> PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset,
> PermissionSet& denied, Boolean checkExecutionPermission)
> at System.Security.SecurityManager.ResolvePolicy(Evidence evidence,
> PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset,
> PermissionSet& denied, Int32& securitySpecialFlags, Boolean
> checkExecutionPermission)
> at
> Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory..cctor()
> --- End of inner exception stack trace ---
> at
> Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp[T](String
> id, IConfigurationSource configurationSource)
> at
> Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.NameTypeFactoryBase`1.Create(String
> name)
> at
> Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase(String
> name)
>
>
> Any help is welcome. Thanks!
> Ben
>


From: Ben on
Thank's both of you for the quick respond.
I tried to use the .NET Framework Administration tool to configure
the framework to grant the assembly the permissions,
but i get the following error:

Application attempted to perform and operation not allowed by the security
policy.
To grant this application the required permission, contact your system
administrator, or
use the Microsoft .NET Framework Configuration tool.
Hash for the assembly cannot be generated.

I also got this error message when i tried to grant permissions to local
assembly, while i'm a system administrator on my local machine.

Do you know what i'm missing?






"Nicholas Paldino [.NET/C# MVP]" wrote:

> Ben,
>
> When you are running an application from a remote computer, it does not
> run with full trust. You will have to launch the application from your
> local computer or go to the .NET Framework Administration tool and configure
> the framework to grant your assembly the permissions you require.
>
> Hope this helps.
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mvp(a)spam.guard.caspershouse.com
>
> "Ben" <Ben(a)discussions.microsoft.com> wrote in message
> news:75AD0E50-A13E-4B87-A83A-E86442B9F31F(a)microsoft.com...
> > Hi,
> > I wrote a C# application that is using the Data Access Application Block
> > Enterprise Library, Jan 2006.
> > When i'm running the application on my local machine everything works
> > fine.
> > The problem occur when i'm trying to run the application from a remote
> > computer using shortcut, i get the following error:
> >
> > System.TypeInitializationException: The type initializer for
> > 'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory'
> > threw an exception. ---> System.IO.FileLoadException: Could not load file
> > or
> > assembly 'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0,
> > Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed
> > to
> > grant minimum permission requests. (Exception from HRESULT: 0x80131417)
> > File name: 'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0,
> > Culture=neutral, PublicKeyToken=null' --->
> > System.Security.Policy.PolicyException: Required permissions cannot be
> > acquired.
> > at System.Security.SecurityManager.ResolvePolicy(Evidence evidence,
> > PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset,
> > PermissionSet& denied, Boolean checkExecutionPermission)
> > at System.Security.SecurityManager.ResolvePolicy(Evidence evidence,
> > PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset,
> > PermissionSet& denied, Int32& securitySpecialFlags, Boolean
> > checkExecutionPermission)
> > at
> > Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory..cctor()
> > --- End of inner exception stack trace ---
> > at
> > Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp[T](String
> > id, IConfigurationSource configurationSource)
> > at
> > Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.NameTypeFactoryBase`1.Create(String
> > name)
> > at
> > Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase(String
> > name)
> >
> >
> > Any help is welcome. Thanks!
> > Ben
> >
>
>
>
 | 
Pages: 1
Prev: WIA and svchost
Next: Interop Events