我已经编写了以下代码,但它不起作用。将文件上传到 Web 服务时出现以下错误:
1.An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full
2.The underlying connection was closed: An unexpected error occurred on a send.
我已将以下代码用于 Web 服务,当文件大小超过 90 mb 时出现错误:
LocalService.IphoneService obj = new LocalService.IphoneService();
byte[] objFile = FileToByteArray(@"D:\Brijesh\My Project\WebSite5\IMG_0010.MOV");
int RtnVal = obj.AddNewProject("demo", "demo", "demo@demo.com", "demo@demo.com", 1, 2, 29, "IMG_0010.MOV", objFile,"00.00.06");
public byte[] FileToByteArray(string fileName)
{
byte[] fileContent = null;
System.IO.FileStream fs = new System.IO.FileStream(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
System.IO.BinaryReader binaryReader = new System.IO.BinaryReader(fs);
long byteLength = new System.IO.FileInfo(fileName).Length;
//byteLength = 94371840;
fileContent = binaryReader.ReadBytes((Int32)byteLength);
fs.Close();
fs.Dispose();
binaryReader.Close();
return fileContent;
}