Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 3 比特,sharpBits.net_Asp.net Mvc 3_Microsoft Bits - Fatal编程技术网

Asp.net mvc 3 比特,sharpBits.net

Asp.net mvc 3 比特,sharpBits.net,asp.net-mvc-3,microsoft-bits,Asp.net Mvc 3,Microsoft Bits,我在我的项目中使用BITS-后台智能传输服务发送大文件。在C#代码中使用SharpBITS.NET。 我想把文件从服务器上传到客户端。我现在注意到双方 -------------客户端--------------- 静态void Main(字符串[]参数) { string local = @"I:\a.mp3"; string destination = "http://192.168.56.128/BitsTest/Home/FileUpload";

我在我的项目中使用BITS-后台智能传输服务发送大文件。在C#代码中使用SharpBITS.NET。 我想把文件从服务器上传到客户端。我现在注意到双方

-------------客户端---------------

静态void Main(字符串[]参数) {

        string local = @"I:\a.mp3";

        string destination = "http://192.168.56.128/BitsTest/Home/FileUpload";

        string remoteFile = @destination;
        string localFile = local;
        if (!string.IsNullOrEmpty(localFile) && System.IO.File.Exists(localFile))
        {
            var bitsManager = new BitsManager();
            var job = bitsManager.CreateJob("uploading file", JobType.Upload);
            job.NotificationFlags = NotificationFlags.JobErrorOccured |      NotificationFlags.JobModified |
                                    NotificationFlags.JobTransferred;

            job.AddFile(remoteFile, localFile);
            job.Resume();

            job.OnJobError += new EventHandler<JobErrorNotificationEventArgs>(job_OnJobError);

        }
    }
但文件上传操作不是接收文件。我不知道如何在客户端接收文件。 如您所见,我将HttpPostedFileBase用于recive文件,但这不起作用

我的主机服务器是Windows server 2008 r2,我已经完成了BITS所需的步骤。有关更多信息,您可以访问以下站点----如何为Configuration Manager 2007站点系统配置Windows server 2008


因此,我不知道如何才能在主机服务器中接收文件。您可以告诉我您可以做什么。

使用类似web应用程序使用的无状态方法,一旦响应完成,就不会连接到服务器。您可以从客户端轮询服务器,但客户端不会侦听服务器发送添加内容阿尔比特

在“过去”中,您可以设置ActiveX控件、Java小程序等(Silverlight today?)继续收听,但这不是直接的web风格开发

如果您愿意使用websocketAPI,HTML5将扩展您的选项。与HTML5的所有部分一样,由于并非所有浏览器都采用了“标准”(预计将在未来10-12年内完成采用:->),因此使用这些比特来实现会有一定的风险

 public ActionResult FileUpload()
        {
            try
            {
                HttpPostedFileBase file = Request.Files[0];
                file.SaveAs(System.IO.Path.Combine(Server.MapPath("/BitsTest/"), file.FileName));
            }
            catch
            { }
            /*System.IO.File.Move(Server.MapPath("/BitsTest/bin/aa.png"), Server.MapPath("/BitsTest/Content/aa.png"));*/
}