469,623 Members | 1,438 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,623 developers. It's quick & easy.

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.PolicyException

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 1775
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***@discussions.microsoft.com> wrote in message
news:DA**********************************@microsof t.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.PolicyException

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.PolicyException
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***@discussions.microsoft.com> wrote in message
news:DA**********************************@microsof t.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.PolicyException

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***@discussions.microsoft.com> wrote in message
news:94**********************************@microsof t.com...
Thank you for your reponse.

I wonder is there any way to catch System.Security.Policy.PolicyException
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***@discussions.microsoft.com> wrote in message
news:DA**********************************@microsof t.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.PolicyException
>
> 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***@discussions.microsoft.com> wrote in message
news:94**********************************@microsof t.com...
Thank you for your reponse.

I wonder is there any way to catch System.Security.Policy.PolicyException
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***@discussions.microsoft.com> wrote in message
news:DA**********************************@microsof t.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.PolicyException
>
> 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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.