Application does not start from network folder

A

Andrus

Managed code .NET 3.5 C# WinForms application runs OK from Vista when in
local drive.

When application is copied to mapped network drive or started from
\\othercmp\c\myapp\myapp.exe folder , it does not start: Vista shows

MyApp has stopped working
Windows is checking for a solution to the problem..

How to fix ?


Andrus.
 
M

Marc Gravell

If you are running a .exe over a network unc, then it won't trust it,
where-as local exes are given higher trust (full?).

Interestingly there is IIRC a change with SP1 which means that mapped
network drives execute with the higher trust. Other than that, there
are two options:

1: use "caspol" to set a higher trust against either the network share
or the application (perhaps using the strong-name as the key)
2: use ClickOnce deployment to the unc and execute the .application;
this includes trust information in the manifest

Marc
 
A

Andrus

Marc,
But this needs to be done from each client. Conversely, ClickOnce will
work for any client that trusts the code-signing certificate.

This requires making changes in every client computer every time when new
version of unsigned application is copied to new network share.

I need that in MDI child form Escape key closes form, Ctrl+F1 cycles and
Ctrl+F10 toggles maximizing. For this I use code below in form base class
which requires full trust.
How to implement those features without full trust ?

Andrus.


[SecurityPermission(SecurityAction.LinkDemand, Flags =
SecurityPermissionFlag.UnmanagedCode)]
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
switch (keyData)
{
case Keys.Escape:
if (this != FormManager.MainForm)
{
Close();
return true;
}
break;

case Keys.Control | Keys.F1:
for (int i = 0; i <
FormManager.MainForm.MdiChildren.Length; i++)
{
if (FormManager.MainForm.MdiChildren == this)
{

if (i <
FormManager.MainForm.MdiChildren.Length - 1)
FormManager.MainForm.MdiChildren[i +
1].Focus();
else
FormManager.MainForm.MdiChildren[0].Focus();

return true;
}
}
return true;

case Keys.Control | Keys.F10:
if (WindowState == FormWindowState.Maximized)
WindowState = FormWindowState.Normal;
else
WindowState = FormWindowState.Maximized;
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
}
 
A

Andrus

Marc,
The following shows how to use caspol to trust a share:

http://msdn.microsoft.com/en-us/library/zdc263t0(VS.80).aspx

But this needs to be done from each client. Conversely, ClickOnce will
work for any client that trusts the code-signing certificate.

This article also recommends to use

Control Panel
Administrative Tools
Microsoft .NET Framework 3.5 Configuration

However in my Vista there is no such option in "Administrative Tools".

Andrus.
 
A

Andrus

The following shows how to use caspol to trust a share:
http://msdn.microsoft.com/en-us/library/zdc263t0(VS.80).aspx

But this needs to be done from each client. Conversely, ClickOnce will
work for any client that trusts the code-signing certificate.

I run with adminstrator rights in Vista

C:\...crosoft.NET\Framework\v2.0.50727>g 1.2 -url file://z:/myapp/*
FullTrust
Microsoft (R) .NET Framework CasPol 2.0.50727.1434
Copyright (c) Microsoft Corporation. All rights reserved.

The operation you are performing will alter security policy.
Are you sure you want to perform this operation? (yes/no)
y
Added union code group with "-url" membership condition to the Machine
level.
Success


However

z:\myapp\myapp.exe

still shows immediately

Myapp as stopped working

Andrus.
 
M

Marc Gravell

This requires making changes in every client computer every time when new
version of unsigned application is copied to new network share.

No, it really doesn't. ClickOnce is designed to handle such scenarios.
No additional client updates will be needed. If you already have a
code-signing certificate that is trusted, or purchase a "pucka" code-
signing certificate, then no changes are required even on vanilla
desktops (with the runtime installed).

Marc
 
M

Marc Gravell

Microsoft .NET Framework 3.5 Configuration

There is an mmc snap-in, but unlike 1.1 it is not part of a standard
install; it requires one of the SDKs to be installed. I have no idea
once, since I haven't used this tool since ClickOnce was released with
2.0 / VS2005. However, caspol.exe *is* part of the core framework
install, hence why I advised to use caspol.exe to deploy any such
changes.

Note that the UI tool, last time I used it, allowed you to export an
msi for installing at clients, but it seemed to overwrite (rather than
extend) the client's settings; so even "back in the day" I used to use
caspol.exe for deployment changes.

Marc
 
D

David H

Managed code .NET 3.5 C# WinForms application runs OK from Vista when in
local drive.

When application is copied to mapped network drive or started from
\\othercmp\c\myapp\myapp.exe folder , it does not start: Vista shows

MyApp  has stopped working
Windows is checking for a solution to the problem..

How to fix ?

Andrus.

There is an one-click solution (well almost one click -- you have to
run it on each target workstation) it is designed for the .NET 2.0.
so I'm not sure it will for your app, but might be worth a shot, or
at least point you in the right direction:
http://www.jjclements.co.uk/index.php/2008/01/21/run-net-application-from-network-share/

David
 
A

Andrus

This requires making changes in every client computer every time when new
No, it really doesn't. ClickOnce is designed to handle such scenarios.
No additional client updates will be needed. If you already have a
code-signing certificate that is trusted, or purchase a "pucka" code-
signing certificate, then no changes are required even on vanilla
desktops (with the runtime installed).

Marc,

my application generates dynamic assembly and creates temporary assemblies
from scripts. I do'nt know how to sign those assemblies.

So it seems that I cannot use signed assemblies since as I know signed
assembly requires that all assemblies it calls must be also signed.

Is it possible to use ClickOnce with unsigned assemblies?

Andrus.
 
A

Andrus

However, caspol.exe *is* part of the core framework
install, hence why I advised to use caspol.exe to deploy any such
changes.

I tried caspol as described in other message but application still causes
unmanaged exception, without net error handling window.

I expect that missing permission should cause .NET unhandled exception
dialog, not

Vista stupid "Application stops responding" window without stack trace.

Andrus.
 
A

Andrus

David,
There is an one-click solution (well almost one click -- you have to
run it on each target workstation) it is designed for the .NET 2.0.
so I'm not sure it will for your app, but might be worth a shot, or
at least point you in the right direction:
http://www.jjclements.co.uk/index.php/2008/01/21/run-net-application-from-network-share/

I installed the file

http://www.jjclements.co.uk/wp-content/uploads/2008/01/security-changes-for-net-20.zip

in Vista SP1 but my application still causes "Myapp has stopped working"
window when running from XP SP3 LAN network folder. My application contains
managed code only.
I tried to run it with "Run as Administrator" but problem persists.
If i copy this folder to my Vista C: drive, it runs OK.

Andrus.
 

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