彗星是在ASP.NET中更容易使用异步页? [英] Is Comet easier in ASP.NET with Asynchronous Pages?

查看:141
本文介绍了彗星是在ASP.NET中更容易使用异步页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的意思不是要问,的是ASPNET比码头彗星更容易?的我的意思是,是彗星容易客栈要么ASPNET或Jetty,相对于其他的选择吗?我想ASP.NET和Jetty的非同步功能,特别是使彗星更具可扩展性在这些平台上实现,我想确认时。

I don't mean to ask, is Comet easier in ASPNET than in Jetty? I mean, is Comet easier inn either ASPNET or Jetty, as compared to other alternatives? I think the asynch capabilities of ASP.NET and Jetty specifically make Comet more scalable when implemented on those platforms and I'd like to confirm that.

ASPNET推出的异步页早在2005年。当时的想法是应用熟悉.NET非同步模式,ASP.NET页面处理

ASPNET introduced "Asynchronous pages" back in 2005. The idea was to apply the familiar .NET asynch model to ASP.NET page processing.

public partial class AsyncPage : System.Web.UI.Page
{
    private WebRequest _request;

    void Page_Load (object sender, EventArgs e)
    {
        AddOnPreRenderCompleteAsync (
            new BeginEventHandler(BeginAsyncOperation),
            new EndEventHandler (EndAsyncOperation)
        );
    }

    IAsyncResult BeginAsyncOperation (object sender, EventArgs e, 
        AsyncCallback cb, object state)
    {
        _request = WebRequest.Create("http://msdn.microsoft.com");
        return _request.BeginGetResponse (cb, state);
    }
    void EndAsyncOperation (IAsyncResult ar)
    {
        string text;
        using (WebResponse response = _request.EndGetResponse(ar))
        {
            using (StreamReader reader = 
                new StreamReader(response.GetResponseStream()))
            {
                text = reader.ReadToEnd();
            }
        }

        Regex regex = new Regex ("href\\s*=\\s*\"([^\"]*)\"", 
            RegexOptions.IgnoreCase);
        MatchCollection matches = regex.Matches(text);

        StringBuilder builder = new StringBuilder(1024);
        foreach (Match match in matches)
        {
            builder.Append (match.Groups[1]);
            builder.Append("<br/>");
        }

        Output.Text = builder.ToString ();
    }
}

Q1:这难道不是让ASP.NET扩展多的Comet风格的应用程序更好?
有没有人用这个和测试它?

Q1: Doesn't this make ASP.NET scale much better for Comet-style applications? Has anyone used this and tested it?

我认为其他的服务器端框架也有类似的东西。如果我没有记错的码头有这样的事情,从而能够更好地规模彗星场景。

I think that other server-side frameworks also have something similar. If I'm not mistaken Jetty has something like this, to enable better scale in Comet scenarios.

Q2:任何人都可以阐明的的光?

Q2: Can anyone shed light on that?

推荐答案

在.NET中的异步处理确实为构建Comet应用程序的基础。具体地,它的IHttpAsyncHandler可以用来作为基础。

The asynchronous processing in .NET does indeed provide a basis for building comet applications. Specifically, it's the IHttpAsyncHandler that can be used as a foundation.

这是说,没有一个第三方库,实施彗星从无到有是...困难。有IIS的一个.NET实现彗星称为 WebSync 将比较的码头。

That said, without a third-party library, implementing Comet from scratch is... difficult. There's a .NET implementation of Comet for IIS called WebSync that would compare against Jetty.

这篇关于彗星是在ASP.NET中更容易使用异步页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆