none
httpwebrequest getresponse timeout RRS feed

  • Pregunta

  • Hello, 

    I have this code that works fine in serveral computers with IIS except in one with windows server 2012.

    using System;

    using System.IO; using System.Xml; using System.Xml.Xsl; using System.Xml.XPath; public class Sample { private const String filename = "books.xml"; private const String stylesheet = "http://server.com/output.xsl"; public static void Main() { //Load the stylesheet. XslTransform xslt = new XslTransform(); using System; using System.IO; using System.Xml; using System.Xml.Xsl; using System.Xml.XPath; public class Sample { private const String filename = "books.xml"; private const String stylesheet = "output.xsl"; public static void Main() { //Load the stylesheet. XslTransform xslt = new XslTransform(); xslt.Load(stylesheet); //Load the file to transform. XPathDocument doc = new XPathDocument(filename); //Create an XmlTextWriter which outputs to the console. XmlTextWriter writer = new XmlTextWriter(Console.Out); //Transform the file and send the output to the console. xslt.Transform(doc, null, writer, null); writer.Close(); } } //Load the file to transform. XPathDocument doc = new XPathDocument(filename); //Create an XmlTextWriter which outputs to the console. XmlTextWriter writer = new XmlTextWriter(Console.Out); //Transform the file and send the output to the console. xslt.Transform(doc, null, writer, null); writer.Close(); } }

    After done the basics (increase the timeout parameter, apply updates, install the  proper .net framework  and check read/write permises), I turned off the firewall as a desperate action but the result is still the same... 

    Timeout exception when processing  xslt.Load(stylesheet); Sentence.

    This is the error message:

    [WebException: The operation has timed out]
       System.Net.HttpWebRequest.GetResponse() +1743
       System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy) +106
       System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) +89
       System.Xml.Xsl.XsltOld.Compiler.ResolveDocument(Uri absoluteUri) +39
       System.Xml.Xsl.XsltOld.ContainerAction.CompileInclude(Compiler compiler) +120
       System.Xml.Xsl.XsltOld.ContainerAction.CompileTopLevelElements(Compiler compiler) +1469
       System.Xml.Xsl.XsltOld.ContainerAction.CompileDocument(Compiler compiler, Boolean inInclude) +142
       System.Xml.Xsl.XsltOld.Compiler.Compile(NavigatorInput input, XmlResolver xmlResolver, Evidence evidence) +302

    [XsltCompileException: XSLT compile error at file:///C:/SISTCP/RecursosSAT/cadenaoriginal_3_3.xslt(9,4). See InnerException for details.]
       System.Xml.Xsl.XsltOld.Compiler.Compile(NavigatorInput input, XmlResolver xmlResolver, Evidence evidence) +658
       System.Xml.Xsl.XslTransform.Compile(XPathNavigator stylesheet, XmlResolver resolver, Evidence evidence) +137
       Default.Button1_Click(Object sender, EventArgs e) +137
       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +11802193
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +150
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1735

    viernes, 26 de julio de 2019 23:46

Respuestas

  • El código que has puesto en la pregunta está mal copiado. Has puesto dos bloques casi idénticos pero en uno pone que stylesheet = "output.xsl" y en el otro pone "http://server.com/output.xsl". Me imagino que el que realmente ejecutas es este último, porque de lo contrario no tendría sentido la traza de pila que sale en el mensaje de error.

    Como primer paso para tratar de identificar la causa, te recomendaría que copies esa URL y trates de acceder a ella directamente desde un browser ejecutado en la misma máquina en la que te falla el programa. Viendo si así funciona o no funciona podremos discernir si se trata de un problema de infraestructura de red o un problema en la ejecución de tu programa.

    • Propuesto como respuesta eRiver1 domingo, 28 de julio de 2019 5:39
    • Marcado como respuesta Pablo RubioModerator miércoles, 31 de julio de 2019 16:43
    sábado, 27 de julio de 2019 11:22