【问题标题】:how do you make sure an async service call is made您如何确保进行异步服务调用
【发布时间】:2011-12-06 10:12:26
【问题描述】:

我使用异步服务,但我对结果不感兴趣。

如何确保将请求发送到服务? 我启动异步的服务没有开始做任何事情。 我相信这是因为请求没有发送..

 ConvertToCubeService.ConvertToCubeFaces param = new ConvertToCubeService.ConvertToCubeFaces();

        var apPath = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath;


        param.EquirectangularFilePath=apPath+context.GetValue(this.EquirectangularImagePath);
        param.imageName = context.GetValue(this.ImageName);
        param.SaveCubicFacesDirectory = apPath + context.GetValue(this.SaveImageDirectoryPath);
        client.ConvertToCubeFacesCompleted += new EventHandler<ConvertToCubeService.ConvertToCubeFacesCompletedEventArgs>(client_ConvertToCubeFacesCompleted);
        client.ConvertToCubeFacesAsync(param);//call async the server to do the work

回调不做任何事情。我只是添加了它,希望这可以使它起作用:

 void client_ConvertToCubeFacesCompleted(object sender, ConvertToCubeService.ConvertToCubeFacesCompletedEventArgs e)
    {
               }

【问题讨论】:

    标签: c# wcf asynchronous


    【解决方案1】:

    你可以(用于测试):

    使用 Fiddler 或 WcfTestClient.exe 访问服务并查看响应/错误?这确保服务可以独立于客户端代码。

    修改服务以便在调用时写入日志?然后你就可以测试客户端命中了。

    PS:如果您真的不关心来自 WCF 服务的响应,我相信您可以设置 OneWay 属性。然后您甚至不必等待它完成处理。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-28
      相关资源
      最近更新 更多