我正在执行以下代码
string requestUrl = "http://SFPRTH010001:18109/1010-SF-TNTIN/Configurator/rest/importConfiguration?";
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(requestUrl);
request.Method = "POST";
request.ContentType = "text/html;charset=utf-8";
//request.ContentType = "application/json";
byte[] fileToSend = File.ReadAllBytes("TestSCDS.properties");
request.ContentLength = fileToSend.Length;
MessageBox.Show(fileToSend.Length.ToString());
using (Stream requestStream = request.GetRequestStream())
{
requestStream.Write(fileToSend, 0, fileToSend.Length);
//MessageBox.Show(requestStream.);
requestStream.Close();
}
using (HttpWebResponse resp = (HttpWebResponse)request.GetResponse())
{
StreamReader reader = new StreamReader(resp.GetResponseStream());
MessageBox.Show(reader.ReadToEnd());
MessageBox.Show(resp.StatusCode.ToString());
}
我得到 HTTP 状态代码“OK”,Fiddler 也显示状态 200。运行这些服务后,我希望更新一些键,但没有发生。有人可以让我知道问题可能是什么吗?