일부 이미지를 처리하는 프로세스를 시작하기 위해 webservice에 대한 호출을 사용합니다. 프로세스가 10 분이 걸리므로 asp.net 클라이언트가 기다리고 싶지 않습니다.응답에 관심이 없을 때 webservice에 대한 비동기 호출 사용
내가 한 것은 처리를 시작하기 위해 서비스에 대한 간단한 호출 비동기였습니다.
하지만 ConvertToCubeService 서비스가 시작하는 것처럼 보이지 않습니다. ConvertToCubeService는 워크 플로 서비스입니다. 다른 워크 플로 서비스의 활동 내에서이를 호출합니다. 이 코드가 ConvertToCubeService에 대한 비동기 호출을 유지한다고 확신합니다.
public sealed class CallProcessingAsync : CodeActivity
{
// Define an activity input argument of type string
public InArgument<string> EquirectangularImagePath { get; set; }
public InArgument<string> SaveImageDirectoryPath { get; set; }
public InArgument<string> ImageName { get; set; }
// If your activity returns a value, derive from CodeActivity<TResult>
// and return the value from the Execute method.
protected override void Execute(CodeActivityContext context)
{
// Obtain the runtime value of the Text input argument
ConvertToCubeService.ServiceClient client = new ConvertToCubeService.ServiceClient();
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
using (var db = new panonestEntities())
{
var p = db.Panoramas.Where(x => x.ImageName.Equals(param.imageName)).First();
p.Status = "Called processing. wait";
db.SaveChanges();
}
}
void client_ConvertToCubeFacesCompleted(object sender, ConvertToCubeService.ConvertToCubeFacesCompletedEventArgs e)
{
using (var db = new panonestEntities())
{
}
}
}
실제로 웹 서버는 Windows 워크 플로 서비스로 구현됩니다. 그래서 저는 그것과 비슷한 것을한다고 생각합니다. 하지만 문제는 내가 비동기 메서드를 호출하고 서비스가 시작되지 않는다는 것입니다. – Ryan
Gotcha, 그건 의미가 있습니다. 서비스를 시작하는 방법에 대한 정보를 제공 할 수 있습니다. – BNL
비동기 호출을 수행하는 코드에서 – Ryan