【发布时间】:2010-09-14 00:21:31
【问题描述】:
我的 .NET 应用程序在从网络驱动器运行时失败,即使相同的可执行文件从本地硬盘驱动器运行得非常好?
我尝试像这样检查“完全信任”:
try
{
// Demand full trust permissions
PermissionSet fullTrust = new PermissionSet( PermissionState.Unrestricted );
fullTrust.Demand();
// Perform normal application logic
}
catch( SecurityException )
{
// Report that permissions were not full trust
MessageBox.Show( "This application requires full-trust security permissions to execute." );
}
但是,这没有帮助,我的意思是应用程序启动并且永远不会进入 catch 块。但是,调试版本显示抛出的异常是由 InheritanceDemand 引起的 SecurityException。有什么想法吗?
【问题讨论】:
-
当你说它“失败”时,它究竟是如何失败的?有错误吗?
-
你写的代码会放在 Catch 里吗?
-
今天刚遇到同样的问题,还没有找到解决办法,会关注这个问题...
标签: c# .net networking securityexception permissionset