C# 如何为长期运行的WCF服务添加进度跟踪器
在我的MVC应用程序中,我正在呼叫WCF服务,这可能需要大约3分钟 WCF基本上接收一个大的输入文件,并将其分解为较小的文件C# 如何为长期运行的WCF服务添加进度跟踪器,c#,ajax,wcf,C#,Ajax,Wcf,在我的MVC应用程序中,我正在呼叫WCF服务,这可能需要大约3分钟 WCF基本上接收一个大的输入文件,并将其分解为较小的文件 [HttpPost] [AllowAnonymous] [ValidateAntiForgeryToken] public ActionResult Index(Batch batch) { var batchSplitter = new BatchSplitterClient(); var resp
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Index(Batch batch)
{
var batchSplitter = new BatchSplitterClient();
var response =
batchSplitter.SplitFile(new BatchSplitterRequest()
{
FilePath = "F:\\BatchFiles\\InputFile\\File_Tabbed_WithNull.txt",
NumberOfRecordsPerFile = 1000
});
return View();
}
WCF基本上只是将拆分的文件转储到输出目录中
我如何向客户端指出一些进展,即在输出目录中创建的每个文件的进展
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
[ServiceContract]
public interface IBatchSplitter
{
[OperationContract]
BatchSplitterResponse SplitFile(BatchSplitterRequest request);
}
WCF服务必须通过自己的API或MVC项目中的某些WebAPI告诉客户他取得了多大的进展,这样客户就可以对服务器的进度进行轮询。我想这就是我想知道的,也就是说,我该如何回传进度?我是否需要添加另一个服务合同,即GetProgress?