C# 4.0 如何在C中使用httpwebrequest将zip文件上载到服务器#

C# 4.0 如何在C中使用httpwebrequest将zip文件上载到服务器#,c#-4.0,C# 4.0,我无法将zip文件上载到服务器。上载此文件时,我收到500个内部服务器错误 请帮帮我 BinaryReader可以工作: FileInfo fInfo = new FileInfo(file.FullName); //long numBytes = fInfo.Length; FileStream fStream = new FileStream(file.FullName, FileMode.Open, FileAccess.Read); BinaryReader br = new Bin

我无法将zip文件上载到服务器。上载此文件时,我收到500个内部服务器错误

请帮帮我

BinaryReader可以工作:

FileInfo fInfo = new FileInfo(file.FullName);
//long numBytes = fInfo.Length;

FileStream fStream = new FileStream(file.FullName, FileMode.Open, FileAccess.Read);

BinaryReader br = new BinaryReader(fStream);

byte[] bdata = br.ReadBytes((int)numBytes);

br.Close();

fStream.Close();

// Write bdata to the HttpStream
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("url-here");
// Additional webRequest parameters settings.
HttpStream stream = (Stream)webRequest.GetRequestStream();
stream .Write(bdata, 0, bdata.Length);
stream.Close();

HttpWebResponse response = (HttpWebRewponse)webRequest.GetResponse();

你能给我们更多关于你的问题的信息吗?你的代码是什么?