【问题标题】:request for the permission of type system net dnspermission failed请求类型系统 net dnspermission 的权限失败
【发布时间】:2013-07-03 08:47:03
【问题描述】:

我有一个使用 OpenPop 库的 .net WebService (.asmx)。我尝试从邮件服务器接收所有邮件,当我从 VisualSudio 进行调试时一切正常,但是当我从 android 应用程序调用 WebService 时,我收到以下错误。 (IIS 中的 WebService 具有 FULL .Net 信任级别,我在项目中添加了 System.Net 引用...)

SoapFault - 故障代码:'soap:Server' 故障字符串: 'System.Web.Services.Protocols.SoapException:服务器无法 处理请求。 ---> System.Security.SecurityException:请求 'System.Net.DnsPermission, System, 类型的权限, 版本=2.0.0.0,文化=中性,PublicKeyToken=b77a5c561934e089' 失败的。在 System.Security.CodeAccessSecurityEngine.Check(对象 需求,StackCrawlMark& stackMark,布尔 isPermSet)在 System.Security.CodeAccessPermission.Demand() 在 System.Net.Dns.GetHostAddresses(字符串主机名或地址)在 System.Net.Sockets.TcpClient.Connect(字符串主机名,Int32 端口)
在 OpenPop.Pop3.Pop3Client.Connect(字符串主机名,Int32 端口, Boolean useSsl, Int32 receiveTimeout, Int32 sendTimeout, RemoteCertificateValidationCallback certificateValidator) 在 OpenPop.Pop3.Pop3Client.Connect(字符串主机名,Int32 端口,布尔值 useSsl) 在 MobileMail.Service1.RefreshMail() 中 d:\MobileMail\Service1.asmx.cs:539 行

using (Pop3Client client = new Pop3Client())
            {
              //line 539:
              client.Connect(acc.POP3Server, acc.POP3Port, Convert.ToBoolean(acc.POP3SSL));
             ...
            }

有人可以帮助我吗? 谢谢!

【问题讨论】:

    标签: c# web-services iis-7.5 asmx openpop


    【解决方案1】:

    我通过这种方式解决了这个错误:“进程模型”下MyWebService的“应用程序池”->“高级设置”,将“加载用户配置文件”设置为TRUE

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-10
      • 2011-04-29
      • 2011-07-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多