高分请问关于使用webclient上传文件的有关问题

高分请教关于使用webclient上传文件的问题!
SL项目使用webclient上传文件,在本机调试是正常的,发布到服务器后,在服务器上用http://localhost:2987打开也能正常上传,但用在服务器上打开http://服务器ip:2987 就是上传不了文件,在其他机器上用ip:2987也无法上传。实在整不明白了,请问大家这是怎么回事?

C# code


        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都不行
        }






------解决方案--------------------
改成这样试试
client.OpenWriteAsync(new Uri("http://"+Request.Url.Authority+"/"+"WebClientUpload.ashx?filename=" + file.Name + "&savepath=" + savePath , UriKind.Absolute), "POST", stream);
//把http://192.168.1.254:2987 换成 "http://"+Request.Url.Authority
------解决方案--------------------
http://msdn.microsoft.com/zh-cn/library/cc838250(v=vs.95).aspx