为什么我的.NET应用程序崩溃从网络驱动器上运行时? [英] Why does my .NET application crash when run from a network drive?

查看:244
本文介绍了为什么我的.NET应用程序崩溃从网络驱动器上运行时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的.NET应用程序失败?

My .NET application fails when run from a network drive even when the very same executable runs perfectly fine from a local hard drive?

我试图检查完全信任,像这样:

I tried checking for "Full trust" like so:

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。任何想法?

However, this isn't helping, by which I mean the application starts up and the catch block is never entered. However, a debug build shows that the exception thrown is a SecurityException caused by an InheritanceDemand. Any ideas?

推荐答案

它确实有做的其实是不太可信的网络位置上的这些应用程序,然后在您的本地硬盘(由于.NET框架的默认策略)。

It indeed has to do with the fact the apps on a network location are less trusted then on your local hdd (due to the default policy of the .NET framework).

如果我没有记错的微软终于纠正了这个烦恼在.NET 3.5 SP1(后不少开发商抱怨)。

If I'm not mistaken Microsoft finally corrected this annoyance in .NET 3.5 SP1 (after a lot of developers complaining).

我google'd是:<一href="http://blogs.msdn.com/vancem/archive/2008/08/13/net-framework-3-5-sp1-allows-managed-$c$c-to-be-launched-from-a-network-share.aspx">.NET Framework 3.5 SP1中允许管理code从网络共享启动!

I google'd it: .NET Framework 3.5 SP1 Allows managed code to be launched from a network share!

这篇关于为什么我的.NET应用程序崩溃从网络驱动器上运行时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆