Question

I have a .net WebService (.asmx) where I use OpenPop library. I try to receive all mails from mailserver and when I make debug from VisualSudio all works fine but when I call the WebService from an android application I receive the error below. (The WebService in IIS have FULL .Net Trust Level, I added System.Net reference in project...)

SoapFault - faultcode: 'soap:Server' faultstring: 'System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Security.SecurityException: Request for the permission of type 'System.Net.DnsPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) at System.Security.CodeAccessPermission.Demand() at System.Net.Dns.GetHostAddresses(String hostNameOrAddress) at System.Net.Sockets.TcpClient.Connect(String hostname, Int32 port)
at OpenPop.Pop3.Pop3Client.Connect(String hostname, Int32 port, Boolean useSsl, Int32 receiveTimeout, Int32 sendTimeout, RemoteCertificateValidationCallback certificateValidator) at OpenPop.Pop3.Pop3Client.Connect(String hostname, Int32 port, Boolean useSsl) at MobileMail.Service1.RefreshMail() in d:\MobileMail\Service1.asmx.cs:line 539

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

Can anybody help me? Thanks!

Was it helpful?

Solution

I solved this error in this way: "Application Pool" -> "Advanced Settings" of MyWebService under "Process Model", set "Load User Profile" to TRUE

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top