471,348 Members | 1,894 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

Application does not start from network folder

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.

Jul 30 '08 #1
11 4104
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
Jul 30 '08 #2
The following shows how to use caspol to trust a share:

http://msdn.microsoft.com/en-us/libr...t0(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.

Marc
Jul 30 '08 #3
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[i] == 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);
}
}

Jul 30 '08 #4
Marc,
The following shows how to use caspol to trust a share:

http://msdn.microsoft.com/en-us/libr...t0(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.
Jul 30 '08 #5
The following shows how to use caspol to trust a share:
>
http://msdn.microsoft.com/en-us/libr...t0(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.

Jul 30 '08 #6
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
Jul 30 '08 #7
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
Jul 30 '08 #8
On Jul 30, 4:10*am, "Andrus" <kobrule...@hot.eewrote:
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.ph...network-share/

David
Jul 30 '08 #9
>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,

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.

Jul 30 '08 #10
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.

Jul 30 '08 #11
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.ph...network-share/
I installed the file

http://www.jjclements.co.uk/wp-conte...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.

Jul 30 '08 #12

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Pete Wittig | last post: by
5 posts views Thread by Martin Robins | last post: by
5 posts views Thread by Jim Heavey | last post: by
2 posts views Thread by Keld R. Hansen | last post: by
7 posts views Thread by Speech Lover | last post: by
4 posts views Thread by =?Utf-8?B?VkIgSm9ubmll?= | last post: by

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.