public static byte[] GetResponseBytes(string apiUrl, string method_name, string postData)
        {
            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(apiUrl);
            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded";
            request.ContentLength = postData.Length;
            request.Timeout = 20000;            HttpWebResponse response = null;            try
            {
                StreamWriter swRequestWriter = new StreamWriter(request.GetRequestStream());
                swRequestWriter.Write(postData);
                if (swRequestWriter != null)
                    swRequestWriter.Close();                response = (HttpWebResponse)request.GetResponse();
                using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
                {
                    return Encoding.UTF8.GetBytes(reader.ReadToEnd());
                }
            }
            finally
            {
                if (response != null)
                    response.Close();
            }
        }
  response = (HttpWebResponse)request.GetResponse();这里报错.基础连接已经关闭: 接收时发生错误。...大家帮忙啊    我的这个错误是出现在我整合discuz论坛的时候出现的,就是实现网站和论坛用户同时登陆注册退出!但是不知道为什么总是出现错误,希望大家帮忙看看...

解决方案 »

  1.   

    查看端口是否正确
    防火墙
    http://www.cnblogs.com/jinglelin/articles/32407.html
      

  2.   


    请问你有做过discuz论坛的整合吗?
      

  3.   


    真额啊,那就可以帮我了
    应用程序名称:FangChan
    应用程序 Url 地址:http://localhost:83/
    登录完成后返回地址:http://localhost:83/User/dntapihandler.aspx
    同步数据的 URL 地址:http://localhost:83/bbs/services/restserver.aspx
    这个是我在论坛后台的一个扩展配置
      

  4.   

    给网站添加MIME的类型,如下:.*
    application/octet-stream