【发布时间】:2012-12-30 20:42:53
【问题描述】:
我有使用这种方法的 WCF 服务。该方法具有 WebInvoke 属性。如何异步调用它?
[WebInvoke(UriTemplate = "*", Method = "*")]
public Message HandleRequest()
{
var webContext = WebOperationContext.Current;
var webClient = new WebClient();
return webContext.CreateStreamResponse(webClient.OpenRead("http://site.com"), "text/html");
}
【问题讨论】:
-
该方法通常由 REST 服务使用。 WebInvoke 通过 Http "POST" 方法调用,而 WebGet 是 Http "GET"。您指的是 REST 服务吗?
-
是的,REST 服务。我通过浏览器使用此服务。
标签: c# wcf asynchronous webinvoke