Asp.net 在F#中实现异步http处理程序的模式?

Asp.net 在F#中实现异步http处理程序的模式?,asp.net,f#,Asp.net,F#,有人能告诉我在F#中编写异步http处理程序时使用的好模式吗 我必须实现IHttpAsyncHandler,该接口需要BeginProcessRequest和EndProcessRequest 我是否返回Async.StartTask?如何处理状态:obj和AsyncCallback?从头开始:使用异步工作流实现处理程序,然后使用async.asbegined公开它 open System open System.Web type HttpAsyncHandler() = let

有人能告诉我在F#中编写异步http处理程序时使用的好模式吗

我必须实现
IHttpAsyncHandler
,该接口需要
BeginProcessRequest
EndProcessRequest


我是否返回
Async.StartTask
?如何处理
状态:obj
AsyncCallback

从头开始:使用异步工作流实现处理程序,然后使用async.asbegined公开它

open System
open System.Web

type HttpAsyncHandler() = 

    let processRequestAsync (context : HttpContext) = async {
        // TODO: implement
        return()
        }

    let beginAction, endAction, _ = Async.AsBeginEnd(processRequestAsync)

    interface IHttpAsyncHandler with
        member this.BeginProcessRequest(context, callback, extraData) = beginAction(context, callback, extraData)
        member this.EndProcessRequest(iar) = endAction (iar)
        // other members omitted

我的想法是:使用异步工作流实现处理程序,然后使用async.asbegined公开它

open System
open System.Web

type HttpAsyncHandler() = 

    let processRequestAsync (context : HttpContext) = async {
        // TODO: implement
        return()
        }

    let beginAction, endAction, _ = Async.AsBeginEnd(processRequestAsync)

    interface IHttpAsyncHandler with
        member this.BeginProcessRequest(context, callback, extraData) = beginAction(context, callback, extraData)
        member this.EndProcessRequest(iar) = endAction (iar)
        // other members omitted

你到底想干什么?如果你有能力,你可能想从中考虑它和它的ILK。您只需覆盖

protected abstract Task<HttpResponseMessage> SendAsync(
    HttpRequestMessage request,
    CancellationToken cancellationToken);
受保护的抽象任务SendAsync(
HttpRequestMessage请求,
取消令牌取消令牌);

方法,使用
async{…}|>async.startask
很容易。您还可以通过静态类型更好地访问HTTP的各种属性。各种子类允许您通过ASP.NET、WCF(自主机)甚至第三方平台运行。

您到底想做什么?如果你有能力,你可能想从中考虑它和它的ILK。您只需覆盖

protected abstract Task<HttpResponseMessage> SendAsync(
    HttpRequestMessage request,
    CancellationToken cancellationToken);
受保护的抽象任务SendAsync(
HttpRequestMessage请求,
取消令牌取消令牌);

方法,使用
async{…}|>async.startask
很容易。您还可以通过静态类型更好地访问HTTP的各种属性。各种子类允许您通过ASP.NET、WCF(自主机)甚至第三方平台运行。

我正在尝试接受一个JSON请求,其中包含大量统计信息,解析它并将其附加到Azure中的blob中。基本上,我现在知道的唯一方法是在Azure中创建一个新的空ASP.Net网站-否则我可能会使用工作角色?但是我如何使用HttpMessageHandler设置它?您应该能够在此处找到更多信息:
HttpMessageHandler
只是最核心的成员,但您可以使用其他选项。我正在尝试接受一个包含大量统计信息的JSON请求,对其进行解析并将其附加到Azure中的blob中。基本上,我现在知道的唯一方法是在Azure中创建一个新的空ASP.Net网站-否则,我可能会使用工作者角色?但是我如何使用HttpMessageHandler设置它?您应该能够在此处找到更多信息:
HttpMessageHandler
只是最核心的成员,但您可以使用其他选项。