System.Net.WebPermission 4.0框架问题

编程入门 行业动态 更新时间:2024-10-25 00:31:10
本文介绍了System.Net.WebPermission 4.0框架问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在项目中将框架工作从3.5更改为4.0时,System.Net.WebPermission对象现在抛出异常。它似乎发生在Assert()方法上。我粘贴了下面的所有常规。当它在3.5中重新编译时,它像往常一样工作。 我在MSDN上的4.0库中找不到任何文档,如果它移动了,程序在用4.0编译时是否会缺少引用? WebPermission myWebPermission = 新的WebPermission(System.Security.Permissions.PermissionState.Unrestricted); myWebPermission.Demand(); myWebPermission.Assert(); ex message 无法在安全透明方法中执行CAS断言 - 当前 '(myWebPermission.ConnectList )。当前' 抛出了'System.InvalidOperationException'类型的异常 object {System.InvalidOperationException} 枚举尚未开始。调用MoveNext。

While changing the frame work from 3.5 to 4.0 on a project the System.Net.WebPermission object is now throwing exceptions. It appears to happen on the Assert() method. I pasted all the usuals below. When it's recompiled in 3.5 it works as usual. I can not find any documentation in the 4.0 library on MSDN, has it moved, could the program be missing a reference when compiled with 4.0? WebPermission myWebPermission = new WebPermission(System.Security.Permissions.PermissionState.Unrestricted); myWebPermission.Demand(); myWebPermission.Assert(); ex message Cannot perform CAS Asserts in Security Transparent methods - Current '(myWebPermission.ConnectList).Current' threw an exception of type 'System.InvalidOperationException' object {System.InvalidOperationException} "Enumeration has not started. Call MoveNext."

推荐答案

本文: 。NET 4安全 - 透明与关键:如何使用AppDom ain.SetData在一个中等受信任的应用程序上? [ ^ ] 使用.NET& amp; ASP.NET 4安全实现。 您可以在受限安全模式下运行IIS站点,这会阻止您使用 System.Security .Permissions.PermissionState.Unrestricted 你想要的。 希望这有帮助。 This article: .NET 4 Security - Transparent vs Critical: How to use AppDomain.SetData on a Medium Trusted App?[^] enlights new security aspects with .NET & ASP.NET 4 security implementation. You may run your IIS site in a restricted security mode, which prevents you from using the System.Security.Permissions.PermissionState.Unrestricted that you want to. Hope this helps.

更多推荐

System.Net.WebPermission 4.0框架问题

本文发布于:2023-11-12 04:37:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1580524.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:框架   Net   System   WebPermission

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!