高分请教关于使用webclient上传文件的问题!
SL项目使用webclient上传文件,在本机调试是正常的,发布到服务器后,在服务器上用http://localhost:2987打开也能正常上传,但用在服务器上打开http://服务器ip:2987 就是上传不了文件,在其他机器上用ip:2987也无法上传。实在整不明白了,请问大家这是怎么回事?
public void UploadFile(FileInfo file, string savePath) { WebClient client = new WebClient(); client.OpenWriteCompleted += new OpenWriteCompletedEventHandler(client_OpenWriteCompleted); client.WriteStreamClosed += new WriteStreamClosedEventHandler(client_WriteStreamClosed); FileStream stream = file.OpenRead(); if (stream.Length < BufferSize) { BufferSize = stream.Length; } client.OpenWriteAsync(new Uri("http://192.168.1.254:2987/WebClientUpload.ashx?filename=" + file.Name + "&savepath=" + savePath , UriKind.Absolute), "POST", stream); //这里我尝试用http://localhost:2987或http://192.168.1.254:2987都不行 }