473,669 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Exception when running from network drive ...

I observe the following strange behavior of my application.
Let say we have managed application MyApp.exe which depend
on a few assemblies MyAssembly1.dll , MyAssembly2.dll and
MyAssembly3.dll . The assemblies I mentione have strong names.

I build the exe and all assemblies on my computer and install
assemblies to GAC. I run MyApp.exe, test it and everything is OK.

Then I copy all executable files (exe and dll) to our network server.

If I try to run MyApp.exe from our network server the application crashes
with the following exception: System.Security .Policy.PolicyE xception

Can anyone explain why this is happening? The very same application runs
OK from local drive but crashes from network drive.

Thanks,
Boris
Nov 17 '05 #1
4 1940
By default the Intranet zone, which includes file shares is not trusted to
run unverifiable code. Use the caspol command line tool or the security
configuration tool that is installed under Administrative Tools to set up
security for this zone (or for assemblies with some specified strong name)
to allow unverifiable code to execute.

Ronald Laeremans
Visual C++ team

"Boris" <Bo***@discussi ons.microsoft.c om> wrote in message
news:DA******** *************** ***********@mic rosoft.com...
I observe the following strange behavior of my application.
Let say we have managed application MyApp.exe which depend
on a few assemblies MyAssembly1.dll , MyAssembly2.dll and
MyAssembly3.dll . The assemblies I mentione have strong names.

I build the exe and all assemblies on my computer and install
assemblies to GAC. I run MyApp.exe, test it and everything is OK.

Then I copy all executable files (exe and dll) to our network server.

If I try to run MyApp.exe from our network server the application crashes
with the following exception: System.Security .Policy.PolicyE xception

Can anyone explain why this is happening? The very same application runs
OK from local drive but crashes from network drive.

Thanks,
Boris

Nov 17 '05 #2
Thank you for your reponse.

I wonder is there any way to catch System.Security .Policy.PolicyE xception
exception and exit gracefully if application doesn't have proper rights to
run on the network server? I was trying to catch the exception but seems to
me it is thrown before first line of the code is executed. Can you advise
how to handle described situation?

Thanks,
Boris

"Ronald Laeremans [MSFT]" wrote:
By default the Intranet zone, which includes file shares is not trusted to
run unverifiable code. Use the caspol command line tool or the security
configuration tool that is installed under Administrative Tools to set up
security for this zone (or for assemblies with some specified strong name)
to allow unverifiable code to execute.

Ronald Laeremans
Visual C++ team

"Boris" <Bo***@discussi ons.microsoft.c om> wrote in message
news:DA******** *************** ***********@mic rosoft.com...
I observe the following strange behavior of my application.
Let say we have managed application MyApp.exe which depend
on a few assemblies MyAssembly1.dll , MyAssembly2.dll and
MyAssembly3.dll . The assemblies I mentione have strong names.

I build the exe and all assemblies on my computer and install
assemblies to GAC. I run MyApp.exe, test it and everything is OK.

Then I copy all executable files (exe and dll) to our network server.

If I try to run MyApp.exe from our network server the application crashes
with the following exception: System.Security .Policy.PolicyE xception

Can anyone explain why this is happening? The very same application runs
OK from local drive but crashes from network drive.

Thanks,
Boris


Nov 17 '05 #3
No there is not. It is thrown by the CLR Loader. And that is very much so by
design since if it ran user code in an unverifiable image, that code could
violate whatever security you are trying to enforce.

Do you want to display a more user friendly error to the user of your
application? Or is there something else you want to accomplish?

Ronald

"Boris" <Bo***@discussi ons.microsoft.c om> wrote in message
news:94******** *************** ***********@mic rosoft.com...
Thank you for your reponse.

I wonder is there any way to catch System.Security .Policy.PolicyE xception
exception and exit gracefully if application doesn't have proper rights to
run on the network server? I was trying to catch the exception but seems
to
me it is thrown before first line of the code is executed. Can you advise
how to handle described situation?

Thanks,
Boris

"Ronald Laeremans [MSFT]" wrote:
By default the Intranet zone, which includes file shares is not trusted
to
run unverifiable code. Use the caspol command line tool or the security
configuration tool that is installed under Administrative Tools to set up
security for this zone (or for assemblies with some specified strong
name)
to allow unverifiable code to execute.

Ronald Laeremans
Visual C++ team

"Boris" <Bo***@discussi ons.microsoft.c om> wrote in message
news:DA******** *************** ***********@mic rosoft.com...
>I observe the following strange behavior of my application.
> Let say we have managed application MyApp.exe which depend
> on a few assemblies MyAssembly1.dll , MyAssembly2.dll and
> MyAssembly3.dll . The assemblies I mentione have strong names.
>
> I build the exe and all assemblies on my computer and install
> assemblies to GAC. I run MyApp.exe, test it and everything is OK.
>
> Then I copy all executable files (exe and dll) to our network server.
>
> If I try to run MyApp.exe from our network server the application
> crashes
> with the following exception: System.Security .Policy.PolicyE xception
>
> Can anyone explain why this is happening? The very same application
> runs
> OK from local drive but crashes from network drive.
>
> Thanks,
> Boris


Nov 17 '05 #4
Yes, I want to display a more user friendly error to the user .
The thrown exception doesn't look good and user might assume that something
wrong with application itself.

Boris
"Ronald Laeremans [MSFT]" wrote:
No there is not. It is thrown by the CLR Loader. And that is very much so by
design since if it ran user code in an unverifiable image, that code could
violate whatever security you are trying to enforce.

Do you want to display a more user friendly error to the user of your
application? Or is there something else you want to accomplish?

Ronald

"Boris" <Bo***@discussi ons.microsoft.c om> wrote in message
news:94******** *************** ***********@mic rosoft.com...
Thank you for your reponse.

I wonder is there any way to catch System.Security .Policy.PolicyE xception
exception and exit gracefully if application doesn't have proper rights to
run on the network server? I was trying to catch the exception but seems
to
me it is thrown before first line of the code is executed. Can you advise
how to handle described situation?

Thanks,
Boris

"Ronald Laeremans [MSFT]" wrote:
By default the Intranet zone, which includes file shares is not trusted
to
run unverifiable code. Use the caspol command line tool or the security
configuration tool that is installed under Administrative Tools to set up
security for this zone (or for assemblies with some specified strong
name)
to allow unverifiable code to execute.

Ronald Laeremans
Visual C++ team

"Boris" <Bo***@discussi ons.microsoft.c om> wrote in message
news:DA******** *************** ***********@mic rosoft.com...
>I observe the following strange behavior of my application.
> Let say we have managed application MyApp.exe which depend
> on a few assemblies MyAssembly1.dll , MyAssembly2.dll and
> MyAssembly3.dll . The assemblies I mentione have strong names.
>
> I build the exe and all assemblies on my computer and install
> assemblies to GAC. I run MyApp.exe, test it and everything is OK.
>
> Then I copy all executable files (exe and dll) to our network server.
>
> If I try to run MyApp.exe from our network server the application
> crashes
> with the following exception: System.Security .Policy.PolicyE xception
>
> Can anyone explain why this is happening? The very same application
> runs
> OK from local drive but crashes from network drive.
>
> Thanks,
> Boris


Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
9707
by: moonriver | last post by:
I write a program accessing files in network drive o:. It is doable as a standalone application. However, if it is running under windows service, the following exception will appear: 13/07/2004 10:24:48 AM run() error: System.IO.IOException: The specified network password is not correct. at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare...
0
1371
by: carbon_dragon | last post by:
The application is a console app, though it does have a temporary windows form console, which is fairly complicated and which was developed in VS2003. I installed VS2005 on an XP OS and tried to see how much work it's going to be to convert over to 2005. I converted the app, tried to compile and resolved all the warnings. One had to be resolved by changing the LIB environment variable. So I fix those and actually compile and run the app...
2
7063
by: David Lindgren | last post by:
Hello! When I am trying to run my .NET application from a network drive a System.Security.SecurityException exception is thrown. Why is that? How do I prevent it? Thanks! /David.
5
21559
by: Niloday | last post by:
Hi All, I am trying to access a mapped network drive from a service that I have created. The service needs to create/delete folders/files on a network drive. When I tried to connect to a folder on mapped network drive (eg. N:\Storage that corresponds to \\FS1NS\SharedDir\), I get an error as "Could not find part of path N:\".
4
3584
by: cmrchs | last post by:
Hi, executing the following on a local drive works fine : FileStream wLog; wLog=File.OpenRead(@"d:\Log.txt"); but executing the same code on a network drive creates a FileIOPermission-exception. although the user has full control on the drive where the application is running. Actually, any IO-statement creates an exception ???
14
2315
by: frostalicious | last post by:
Used VB.NET (on my client PC) to convert VB6 executable to .NET executable. Placed the .exe file on a network drive on my server. From client, ran .NET Wizards "Trust an Assembly" to make the .exe (on the network drive, on the server) "Full Trust." From the client, double-click on the ..exe (on the network drive, on the server) and it runs fine. So far, so good, but... On the server, where I've installed not VB.NET but .NET
1
971
by: Robin Tucker | last post by:
Hi, I recently wrote a really simple key generator for our software. It is designed so that it is only capable of being run from a given server, by checking an encrypted MAC address and other noddy stuff. When I run the software by double clicking it in the server folder, I get security exception for WMI and File I/O, however when I copy the .exe to my desktop and run it from there, I don't get any security exceptions. Does the .NET...
5
2512
by: Bob | last post by:
Hi, I have some very simple code that I have been using for quite a while that uses a streamwriter to write to a network file. I have never had any problems with it. I recently updated Visual Studio 2005 with Service Pack 1 and now it gives me the "Directory not found " exception when I try to write to a network location. I am running it on Vista as a standard user. However, I have opened Visual Studio using the "run as...
0
1308
by: anoop23 | last post by:
Hi, Im running a timer to Unzip a zip file using a 'ICSharpCode.SharpZipLib.dll'. It works well when I block the main thread indefinitely by 'thread.sleep(-1)'. But gets an ThreadAbort Exception if i run the timer without thread blocking. How can i avoid this error?Im not using thread.abort anywhere in my code.My code to unzip file is taking only 6 sec to complete. Below im showing the code.
0
8465
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8383
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8895
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8809
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8588
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7407
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2032
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.