从网络驱动器运行时我的.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." );
}
Run Code Online (Sandbox Code Playgroud)
但是,这没有帮助,我的意思是应用程序启动并且永远不会输入catch块.但是,调试版本显示抛出的异常是由InheritanceDemand引起的SecurityException.有任何想法吗?