c# – WCF功能返回后继续
发布时间:2020-12-16 01:51:33 所属栏目:百科 来源:网络整理
导读:我有一个Web应用程序通过WCF连接到 Windows服务并调用方法.在该方法返回其结果后(并且所有内容都成功 – 请参见下面的行**)我希望该服务继续并执行其他一些工作. 最简单的方法是什么? 谢谢 达摩 C#代码 //Add Files To Control Manager public ReturnClass
我有一个Web应用程序通过WCF连接到
Windows服务并调用方法.在该方法返回其结果后(并且所有内容都成功 – 请参见下面的行**)我希望该服务继续并执行其他一些工作.
最简单的方法是什么? 谢谢 C#代码 //Add Files To Control Manager public ReturnClass FilesToControl(List<Item> lstNewItems,string ReferenceNumber,string Type,String Description) { try { String ThisisAnItemToControl = ""; String ThisIsItsType = ""; for (int i = 0; i < lstNewItems.Count; i++) // Loop through List with for { ThisisAnItemToControl = lstNewItems[i].Paramater; ThisIsItsType = lstNewItems[i].Type; // Do a pre check on the item // Does File Exist if (!File.Exists(ThisisAnItemToControl)) return new ReturnClass(-1,ThisisAnItemToControl + " does not exist",String.Empty,null,null); } return new ReturnClass(1,"",null); // Now that we have returned a result to the web application we can get to work and modify the items under control but how can i do this? // **?? } catch (Exception ex) { return new ReturnClass(-1,ex.Message.ToString(),null); } 解决方法
我要做的是将额外的工作放在另一个功能中.然后,在从WCF函数返回之前,为额外的工作函数创建一个新线程并运行它.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |