How to delpoy a .Net application

T

Thorpe

I have build a .Net (C#) winform application. The application opens and
reads and writes to an xml file that is stored with the assembly.

When I run the program on my local PC everything works.
I have the need for a number of different people to run the application.
I copied the assembly and related files on a server I connected to the a
share on the server from my local PC and tried running the application I got
an error that said

The Application attempted to perform an operation not allowed by the
security policy. The operation required the secuirtyexception use the
Microsoft.Net security policy administration tool.
System.Security.SecurityException: Request for the permission of type
System.Security.Permissions.FileIOPermission, mscorlib,

if I run the application directly on the server then the application works.
I guess there is an issues running over the network.
The servers and my local pc is part of an Active directory domain
How can I solve this problem and what is the best way to deploy a .Net
application?

thanks in advance
 
R

Rob Windsor [MVP-VB]

Hi,

The reason you're getting this error is applications that are loaded from a
network share are denied permission to do certain tasks. For example, the
error you received said that your application requested a
System.Security.Permissions.FileIOPermission (it wanted to read from your
local disk) but it was denied.

The technology in .NET that manages this is called Code Access Security
(CAS). Basically every time the CLR loads an assembly (EXE or DLL) it
gathers evidence about it like where the file was located, what it's public
key is, if it has a certain hash or digital signature and so on. Based on
this evidence it grants certain permissions to the code in the assembly and
denies others. Code loaded from your local hard drive has Full Trust,
meaning that the CLR will allow all code in the assembly to run (however
Windows security is still enforced).

As far as deployment goes, what you are trying to do is called No-Touch
Deployment or Smart Client Deployment. It is a great feature of .NET and it
allows full featured Windows Forms apps to be deployed almost as easily as a
web app.

There are tons of great articles and webcasts out there on these topics,
some of which are linked to at http://www.tvbug.com/diary/20030923.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top