我试图使用.NET Micro Framework(C#)从Fez Panda II微控制器板上创建HTTP POST,但以下代码会抛出异常在尝试获取请求流时查看代码片断。我似乎无法在互联网上的任何地方找到有关此特定错误的任何信息。.NET Micro Framework中的HTTP POST - GetRequestStream()上的异常
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.urlofthewebsite.com/Word/");
string name = "00ABCDEFDEADBEEF";
string rawData = "2012-02-08\t14:53:08\t755F66";
try
{
string postData = "deviceID=" + name + "&rawData=" + rawData;
Debug.Print(postData);
byte[] data = Encoding.UTF8.GetBytes(postData);
//request.ContentType = "application/x-www-form-urlencoded";
//request.ContentLength = data.Length;
//Set parameters of web request for HTTP POST
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = data.Length;
request.KeepAlive = false;
//Create a stream to send the post data to
//ERROR OCCURS HERE
Stream postDataStream = request.GetRequestStream();
etc.
调试输出:
#### Exception System.Exception - 0x00000000 (1) ####
#### Message: DNS server IP address was not found.
#### GHIElectronics.NETMF.Net.Dns::GetHostEntry [IP: 0038] ####
#### GHIElectronics.NETMF.Net.HttpWebRequest::EstablishConnection [IP: 00e1] ####
#### GHIElectronics.NETMF.Net.HttpWebRequest::SubmitRequest [IP: 0013] ####
#### GHIElectronics.NETMF.Net.HttpWebRequest::GetRequestStream [IP: 0008] ####
#### Fresh_Step.Program::httpPostRawData [IP: 0052] ####
#### Fresh_Step.Program::Main [IP: 0004] ####
A first chance exception of type 'System.Exception' occurred in GHIElectronics.NETMF.W5100.Http.dll
还有什么问题呢?很感谢任何形式的帮助。如果需要更多信息,我很乐意提供。
您有可能给我们提供您要提交页面的链接吗? – 2012-03-26 04:08:42