c# - Unable to connect to the remote server with HTMLworker -


I am developing a web application in C # and using it usingexshharp.text elements. Iextsharp and its sections are very new. Please help me with this error: Unable to connect to a remote server

Here my code And the stack trace is:

  Public Zero CreatePDFDocument (string strHtml) {DirectoryInfo thisFolder = New Directory Info (Server.MapPath ("Temp")); If (thisFolder.Exists) {if (File.Exists (Server.MapPath ("Temp / test.pdf")) {File.Delete (Server.MapPath ("Temp / test.pdf")); } ThisFolder.Delete (); ThisFolder.Create (); } Else {thisFolder.Create (); } String strFileName = Server.MapPath ("Temp / test.pdf"); // Step 1: Create document-object document document = new document (); // Step 2: // We create an author who hears the document PdfWriter.GetInstance (document, new FileStream (strFileName, FileMode.Create); = New stringreader (str HHML) from stringreader; HTMLWorker obj = new HTMLWorker (document); Document.Open (); Obj.Parse (se); // This line throws the error document. Close (); ShowPdf (strFileName); }  

throws a row error in bold

Here is a stack trace:

System.Net.WebException occurred

HResult = -2146233079

Message = to connect to disabled remote server

source = system

StackTrace: System.Net.HttpWebRequest.GetResponse ()

on iTextSharp.text.Image.GetInstance (Uri url, Boolean handleIncorrectImage)

iTextSharp.text.Image.GetInstance (Uri url)

p> (string

2 attrs, ChainedProperties chain, IDocListener document, IImageProvider img_provider, dictionary

On iTextSharp.text.html.simpleparser.HTMLTagProcessors.HTMLTagProcessor_IMG.StartElement (HTMLWorker worker, string tags, IDictionary`2 attrs)

on iTextSharp.text.html.simpleparser.HTMLWorker.StartElement (string tags, IDictionary`2 attrs)

on iTextSharp.text.xml.simpleparser.SimpleXMLParser.ProcessTag (Boolean start)

on ITextSharp.text.xml.simpleparser.SimpleXMLParser.Go (TextReader Reader)

on iTextSharp.text.xml.simpleparser. SimpleXMLParser.Parse (ISimpleXMLDocHandler doc, ISimpleXMLDocHandler comments, TextReader r, Boolean html)

iTextSharp.text.html.simpleparser.HTMLWorker.Parse (TextReader reader)

Payroll F. On PaySlip.CreatePDFDocument (string strHtml): \ New Folder \ EMS \ EMS \ Payroll \ PaySlip.aspx.cs: Line 88

InException: System.Net.Sockets.SocketException

HResult = -2147467259

Message = No connection can be made because the target machine actively refuses it 127.0.0.1:5510

source = system

< P> Error = 10061

NativeErrorCode = 10061

StackTrace: On Sy stem.Net.Sockets.Socket .DoConnect (EndPoint endPointSnapshot, SocketAddress socketAddress)

System.Net.ServicePoint.ConnectSocketInternal (Boolean connectFailure, socket S4, S6 socket, the socket & amp; socket, Aipiadder & Amp; address, ConnectSocketState State, IASINRSultEsync Results, Exceptions & amp; Exceptions)

Inner Expansion:

Uncertain without content of HTML, but it is applicable to you:?

Excerpt from that page:

Your HTML string contains images that point to some external servers and the iTextSharp library is used to obtain images from that server. Attempting and failing to do so, you are receiving those errors.

Try acces thorre images from your browser in the same machine.


Comments