我有以下警告,我看不到任何解决方案,也许因为我很困,
以下是发送请求的代码;
string requestUrl = string.Format(xml, customerNo, -2, requestXml);
string url = WebServiceParameters.GetString("_SERVICE") + requestUrl;
Uri uri = new Uri(url);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}", "Name", "Pass"))));
request.Headers.Add("Content-Length: 0");
request.ContentType = "text/xml;charset=\"utf-8\"";
request.Accept = "text/xml";
request.Method = "POST";
IAsyncResult asyncResult = request.BeginGetResponse(null, null);
asyncResult.AsyncWaitHandle.WaitOne();
LogRequest(requestUrl);
WebResponse response = request.GetResponse();
StreamReader sr = new StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("windows-1254"));
string result = sr.ReadToEnd();
LogResponse(result);
sr.Close();
response.Close();
这是错误; 必须使用适当的属性或方法修改“Content-Length”标头。
先谢谢
答案 0 :(得分:0)
尝试在web.config
中使用它<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="500000000" />
</webServices>
</scripting>
</system.web.extensions>