运行 C# 应用程序,遵守“允许不安全代码”要求从网络位置设置
我的 C# 应用程序使用指针,因此使用“允许不安全代码”设置进行编译。 我知道从网络位置运行这样的应用程序非常困难或根本不可能。(或者有什么方法可以运行它吗??) 我想知道的是,是否有任何方法可以处理尝试从网络位置运行此应用程序时发生的错误并使应用程序正常失败。 我收到以下错误... “应用程序遇到问题,需要关闭”。异常信息包含以下代码: 0xe0434f4d
My C# application uses pointers and hence is complied using the "Allow Unsafe Code" setting.
I know that it is quite difficult or not possible at all to run such an application from a network location.(or is there any way to run it??)
What I would like to know is, is there any way to handle the error that occurs while trying to run this application from a network location and make the application fail gracefully.
I am getting the following error...
"Application has encountered a problem and needs to close". Exception Information contains the following code:
0xe0434f4d
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
更改安全设置(使用 CASPOL 实用程序)以允许此执行。这并不困难 - 您可以/至少应该将您的 Intranet 已知位置放入 Intranet 区域;)
否则 - 是和否。您无法获得该异常,但您实际上可以在代码中检查/声明所需的 CAS 权限,以确保您首先拥有它们。
CAS 很复杂。而且知道的人并不多。
检查 http://support.microsoft.com/kb/315529 作为起点。
Change security settings (using the CASPOL utility) to allow this execution. it is not that difficult - you can / should at least put your intranet known locations into the intranet zone there ;)
otherwise - yes and no. You can not get that exception, but you can actually check / claim the needed CAS rights in code to make sure you have them in the first place.
CAS is like - complicated. And not many people know about it.
Check http://support.microsoft.com/kb/315529 as a starting point.
从 .NET 3.5 sp1 开始,然后从网络共享运行代码获得与在本地计算机上运行相同的权限。如果计算机具有 .NET 3.5 sp1,您应该能够运行不安全的代码。
From .NET 3.5 sp1 then running code from a network share gets the same rights as running on a local machine. You should be able to run unsafe code if the machine has .NET 3.5 sp1.