Error when executing from a network share

J

Jose Cintron

I created a pretty basic program based on the "Windows Forms Application"
template using C++ in VS 2005. When I run the program from my local system
it runs properly (do happy dance), now when I copy the same program to a
network share (I have a drive mapped to it) and execute the same program I
get an error message that reads

=== Start Error Pop-up Window ===
Reporter.exe has encountered a problem and needs to close. We
are sorry for the inconvenience.

If you were in the middle of something, the information you were working on
might be lost.

Please tell Microsoft about this problem.

We have created an error report that you can send to help us improve
Reporter.exe. We will treat this report as confidential and anonymous.

What datta does this report contain?
Why should I report to Microsoft?

<Debug> <Send Error Report> <Don't Send>
=== End Error Pop-up Window ===

When I click on debug I get the following...

=== Start Debug message ===
An unhandled exception of type 'System.IO.FileLoadException' occurred in
Unknown Module.

Additional information: Could not load file or assembly 'Reporter,
Version=1.0.2439.41345, Culture=neutral, PublicKeyToken=null' or one of its
dependencies. Failed to grant minimum permission requests. (Exception from
HRESULT: 0x80131417)
=== End Debug message ===

Any ideas on what the heck does this means? Do I have to set something in
my project to allow the program to run from a network share (that would be
stupid). TIA!
 
S

SvenC

Hi Jose,

Jose Cintron said:
I created a pretty basic program based on the "Windows Forms Application"
template using C++ in VS 2005. When I run the program from my local system
it runs properly (do happy dance), now when I copy the same program to a
network share (I have a drive mapped to it) and execute the same program I
get an error message that reads

=== Start Error Pop-up Window ===
Reporter.exe has encountered a problem and needs to close. We
are sorry for the inconvenience.
Additional information: Could not load file or assembly 'Reporter,
Version=1.0.2439.41345, Culture=neutral, PublicKeyToken=null' or one of
its dependencies. Failed to grant minimum permission requests. (Exception
from HRESULT: 0x80131417)
=== End Debug message ===

Any ideas on what the heck does this means? Do I have to set something in
my project to allow the program to run from a network share (that would be
stupid). TIA!

Only assemblies in the local computer zone have full trust and that is the
failing mimimum permission.
You can use the "Microsoft .Net Framework 2.0 Configuration" console. On my
machine its in Start > Administrtative Tools. Might depend on the version of
VC++ your are using if it is present or not. It is part of the .Net 2.0 SDK.

Open My Computer > Runtime Security Policy > Machine > Code Groups >
All_Code
Right click and choose New...
Give it a name, e.g. "C++ test". Next
Choose URL as condition type and type the UNC path of your app: either
complete with "...\your.exe" or only the path followd by "\*" to configure
all assemblies in that path. Next
Use "FullTrust" permission set. Next. Finish

Start your app...

You might also sign your assembly. Then you can use Strong Name or Publisher
instead of URL.

Lookup the documentation for caspol to find a command line tool to
create/set those code permission.
 
D

dirk

Hello SvenC

Is there a recommended way to check whether FullTrust (or whatever is
required) is granted. I think an application should check this when starting
and show a more informative dialog, so that a normal user can solve the
problem. Probably this should be done by the runtime, depending on the
assembly you may not get a chance to do any checks.

Dirk
 
S

SvenC

Hi Dirk,

dirk said:
Hello SvenC

Is there a recommended way to check whether FullTrust (or whatever is
required) is granted. I think an application should check this when
starting
and show a more informative dialog, so that a normal user can solve the
problem. Probably this should be done by the runtime, depending on the
assembly you may not get a chance to do any checks.

I guess this is by design impossible because if you could catch that
exception you could in fact run all code you like and do whatever the
currently logged on user can do in his logon session. You might get around
this if you split your assembly into a safe one that will not require
FullTrust. That might demand FullTrust and if available dynamically load
another assembly or else display an error message. I guess the problem might
be that for loading assemblies dynamically you will again need FullTrust.
Bottom line could be: use a technique like ClickOnce to deploy your apps to
get client machines configured correctly.
 
J

Jose Cintron

Hi Sven

One question... Will this also be an issue if I attempt to execute the
program from a CD?
 
S

SvenC

Hi Jose,

Jose Cintron said:
Hi Sven

One question... Will this also be an issue if I attempt to execute the
program from a CD?

If the CD drive is directly connected I would expect it to be treated as
local computer so it should work. If you access it through a share you
should need FullTrust.

--
SvenC
 

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