应用程序不从网络文件夹启动 [英] Application does not start from network folder
问题描述
托管代码.NET 3.5 C#WinForms应用程序在使用
本地驱动器时从Vista运行。
将应用程序复制到映射网络驱动器或启动时来自
\\othercmp\c\myapp \ myapp.exe文件夹,它无法启动:Vista显示
MyApp已停止工作
Windows正在检查问题的解决方案..
如何解决?
Andrus。
如果您正在通过网络运行.exe,那么它就不会信任它,
其中 - 本地exes被赋予更高的信任度(完全?)。
有趣的是,IIRC对SP1进行了更改,这意味着已映射的
网络驱动器执行更高的信任。除此之外,
有两种选择:
1:使用caspol设置更高的信任对网络共享
或应用程序(可能使用强名称作为密钥)
2:使用ClickOnce部署到unc并执行.application;
这包括清单中的信任信息
Marc
以下节目如何使用caspol来信任一个共享:
http://msdn.microsoft.com/en-us/libr...t0(VS.80).aspx
但这需要从每个客户那里完成。相反,ClickOnce将
适用于任何信任代码签名证书的客户。
Marc
< blockquote> Marc,
但这需要从每个客户端完成。相反,ClickOnce将为任何信任代码签名证书的客户工作
。
这要求每次将新的
版本的未签名应用程序复制到新网络共享时,在每台客户端计算机上进行更改。
我需要在MDI子窗体中使用Escape键关闭窗体,Ctrl + F1循环和
Ctrl + F10切换最大化。为此,我使用下面的代码形式基类
,这需要完全信任。
如何在没有完全信任的情况下实现这些功能?
Andrus。
[SecurityPermission(SecurityAction.LinkDemand,Flags =
SecurityPermissionFlag.UnmanagedCode)]
protected override bool ProcessCmdKey(ref Message msg ,键keyData)
{
开关(keyData)
{
案例Keys.Escape:
if(this!= FormManager.MainForm)
{
关闭();
返回true;
}
休息;
案例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();
返回true;
}
}
返回true;
case Keys.Control | Keys.F10:
if(WindowState == FormWindowState.Maximized)
WindowState = FormWindowState.Normal;
else
WindowState = FormWindowState.Maximized;
返回true;
}
返回base.ProcessCmdKey(ref msg,keyData);
}
}
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.
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
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
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);
}
}
这篇关于应用程序不从网络文件夹启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!