当前位置:编程学习 > C#/ASP.NET >>

HttpWebRequest Timeout急求解

代码如下,在windows平台上部署好后发送请求可以返回inputStream数据流
但是在linux上部署后出现System.Net.WebException: The request timed out的问题
发现被System.Net.HttpWebRequest请求的文件根本没有被访问
是不是在linux上使用System.Net.HttpWebRequest需要有什么特别的配置呀
          
            System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(hostURL);
            request.ContentType = "application/x-www-form-urlencoded";
    using (WebResponse response = request.GetResponse())
                {

                        using (Stream inputStream = response.GetResponseStream())
                        {
                            //向服务器请求,获得服务器回应数据流
                            int actualSize = 0;
            //使用ReceiveStreamData方法把流写入_Buffer(byte[]数组),然后进行输出
                            ErrorCodes resultRead = ReceiveStreamData(inputStream, _Buffer, out actualSize);
                            HttpContext current = HttpContext.Current;
                            if (current == null)
                            {
                                throw new ApplicationException("Current System.Web.HttpContext not found - Send failed.");
                            }
                            if (!current.Response.Buffer)
                            {
                                current.Response.Buffer = true;
                                current.Response.Clear();
                            }
                            inputStream.Close();
                            response.Close();
                            current.Response.ContentType = "application/octet-stream";//MIME类型:匹配任意文件类型    
                            current.Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileTrueName, Encoding.UTF8).Replace("+", "%20"));
                            Response.BinaryWrite(_Buffer);
                            Response.Flush();

                        }

                } --------------------编程问答-------------------- 急求解,大家帮忙 --------------------编程问答-------------------- 问题很难么,怎么没人帮忙,着急 --------------------编程问答-------------------- 急求解,大家帮忙
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,