0
비동기 wcf 서비스에서 'ManualResetEvent'를 사용하는 방법을 알려줄 수 있습니까? 비동기 wcf 서비스를 호출하는 콘솔 응용 프로그램이 있고 'oncomplete'이벤트가 끝난 후에 콘솔 응용 프로그램을 닫고 싶습니다.WCF 비동기 - ManualResetEvent를 사용하는 방법
가능하면 샘플을 보내주십시오.
미리 감사드립니다. 당신은 단지 하나의 메소드 호출을 수행하는 경우
class Program
{
static ManualResetEvent exitEvent = new ManualResetEvent(false); // Create the wait handle
static void Main()
{
using(var client = CreateYourClient())
{
client.MethodCompleted += MethodCompleted;
client.MethodAsync(); // Start method
exitEvent.WaitOne(); // Block until the method is done...
}
}
static void MethodCompleted(object sender, MethodCompletedEventArgs args)
{
// Do your work...
// At this point, signal that the console can close...
exitEvent.Set();
}
}
그러나, 그냥 동기하기 위해 아마 더 낫다 :
감사 리드. 나는 그것을 시도하고 당신에게 알려 줄 것이다. 당신의 도움을 주셔서 감사합니다. – CoolArchTek