1

我已经修改了 asp.net web 处理程序并将其部署在服务器上。

该处理程序使用静态 XML 文件在我的本地计算机上工作得更好,但在部署时会出现 IIS 500 错误。

是否有我可以用来修改我的代码以针对实时数据馈送运行的示例?

这是我对静态文件使用的:

WebRequest 请求 = null; WebResponse rsp = null; 尝试 { 字符串 uri = "https://mytestSite.com/Test_Handler.ashx";

            req = WebRequest.Create(uri);
            req.Method = "POST";        // Post method
            req.ContentType = "text/xml";     // content type


            // Wrap the request stream with a text-based writer
            StreamWriter writer = new StreamWriter(req.GetRequestStream());


            // Write the XML text into the stream
                            //StreamReader reader = new StreamReader(Server.MapPath("~/20121129-0121-1.xml"));




            -- Would this line capture the stream ????????
            StreamReader reader = new StreamReader(req.GetRequestStream());




           string ret = reader.ReadToEnd();
           reader.Close();


            writer.WriteLine(ret);
            writer.Close();


            // Send the data to the webserver
            rsp = req.GetResponse();         //Calls the handler code
            StreamReader sr = new StreamReader(rsp.GetResponseStream());
            string responseString = sr.ReadToEnd();
            sr.Close();
4

0 回答 0