Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application Trust Level on Network Drive for Nhibernate C# Application

Scenario: I have a C# application that uses Click-Once to install(puts an icon on the desktop that points to the application) itself on computers on the network. I have recently been integrating NHibernate into the program and everything runs smooth on my box. Its ready for internal testing and I need to put it on our network share (Same share as production, different folder).

Problem: When I place it on the network share and run it I recieve an error saying the application cannot run in partial trust.

Question: I have googled this to no end and every solution seems to talk about a Web Application experiencing this. Is there anyway I can set the application to run in full trust mode on a network share. Setting the folder/exe to full trust? Is this simply allowing "Full Control" in the security tab of my applications properties?

Here is the error I recieve when running the application alt text

Thanks for any input

like image 588
Gage Avatar asked Nov 11 '10 18:11

Gage


2 Answers

You need to set the security policy on the client machine using CasPol.exe or the configuration tool in Administrative Tools.

  • Code Access Security Policy Tool
  • Using CasPol to Fully Trust a Share
  • .NET Framework Configuration Tool (Mscorcfg.msc)
  • Code Access Security Policy (CASPOL.exe) GUI Utility

Alternatively, you can upgrade to .net 4.0, which gets rid of all this.

EDIT: You can also try adding [assembly: AllowPartiallyTrustedCallers]to the referenced assembly.

like image 87
SLaks Avatar answered Sep 22 '22 01:09

SLaks


Putting an Icon on the desktop that points to a network share does not sound like Click-once.

But this 'problem' should be solved from Fx 3.5 SP1 onwards.

like image 25
Henk Holterman Avatar answered Sep 20 '22 01:09

Henk Holterman