对 Microsoft WebSockets 命名空间感到困惑

发布于 2024-12-12 01:22:40 字数 2037 浏览 0 评论 0原文

到目前为止,在教程、博客和官方文档中,我已经看到:

  • Microsoft.Web.WebSockets
    • 从 NuGet 获取
    • 程序集是 Microsoft.WebSockets,但命名空间是 Microsoft.Web.WebSockets
    • 最后更新时间:2011 年 9 月 14 日
    • 包含 WebSocketHandler、WebSocketCollections、WebSocketExtensions
  • System.Web.WebSockets
    • 属于 .NET 4.5 的一部分,可在 Visual Studio 11 开发者预览版中使用
    • 包含 AspNetWebSocket、AspNetWebSocketContext、AspNetWebSocketOptions 类
    • MSDN 上的文档
  • System.Net.WebSockets
    • 感谢 Ladislav Mrnka 指出这一点
    • 属于 .NET 4.5 的一部分,可在 Visual Studio 11 开发者预览版中使用
    • 包含 WebSocket、HttpListenerWebSocketContext 等
    • MSDN 上的文档
  • System.ServiceModel.WebSockets
    • 我一定以为我在某处见过这个,但现在找不到了
  • Microsoft.ServiceModel.WebSockets
    • html5labs.interoperabilitybridges.com/...获取。
    • 安装到 [Program Files]\Microsoft SDKs\WCF WebSockets\11.06.22\bin
    • 包含 WebSocketHost、WebSocketService、WebSocketsService 类以及接口和集合
    • 最后更新时间:2011 年 6 月 22 日

这些有什么不同吗?有一些旧版本吗?

我一直假设“Microsoft.Web”命名空间用于预发布代码,但即使是 Build 会议上的演示也使用此命名空间,尽管 .NET 4.5 包含内置的 System.Web.WebSockets 命名空间。

System.Web.WebSockets 似乎具有与 Microsoft.Web.WebSockets 相同的 API,但其类和方法以 AspNet 为前缀。

System.ServiceModel.WebSockets 是 WCF 命名空间的一部分,这似乎也是放置这些东西的明智位置。

帮助 - 我很困惑。我应该使用什么?

So far, in tutorials, blogs, and official documentation, I've seen:

  • Microsoft.Web.WebSockets
    • Obtained from NuGet
    • The assembly is Microsoft.WebSockets, but the Namespace is Microsoft.Web.WebSockets
    • Last updated 14 Sept 2011
    • Contains WebSocketHandler, WebSocketCollections, WebSocketExtensions
  • System.Web.WebSockets
    • Part of .NET 4.5 and available in Visual Studio 11 Developer Preview
    • Contains AspNetWebSocket, AspNetWebSocketContext, AspNetWebSocketOptions classes
    • Documentation on MSDN
  • System.Net.WebSockets
    • Thanks Ladislav Mrnka for pointing this one out
    • Part of .NET 4.5 and available in Visual Studio 11 Developer Preview
    • Contains WebSocket, HttpListenerWebSocketContext and more
    • Documentation on MSDN
  • System.ServiceModel.WebSockets
    • I must have imagined I'd seen this one somewhere, can't find it now
  • Microsoft.ServiceModel.WebSockets
    • Obtained from html5labs.interoperabilitybridges.com/....
    • Installed into [Program Files]\Microsoft SDKs\WCF WebSockets\11.06.22\bin
    • Contains WebSocketHost, WebSocketService, WebSocketsService classes, plus interfaces and collections
    • Last updated 22 June 2011

are these somehow different? Are some older versions?

I've always assumed the 'Microsoft.Web' namespace was used for pre-release code, but even the demos at the Build conference use this namespace, despite the fact that .NET 4.5 includes the System.Web.WebSockets namespace built in.

System.Web.WebSockets seems to have the same API as Microsoft.Web.WebSockets, but with classes and methods prefixed with AspNet.

System.ServiceModel.WebSockets is part of the WCF namespace, which also seems a sensible place to put this stuff.

Help - I'm confused. What should I be using?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

生死何惧 2024-12-19 01:22:40

我会为您的困惑添加更多内容。 Microsoft.* 前缀的程序集/命名空间通常要么非常特定于某种语言,要么不是 .NET 框架的一部分(带外(或原型)交付)。

.NET 框架附带的程序集/命名空间通常以 System.* 开头。 .NET 4.5 中有两个包含与 WebSocket 相关功能的命名空间:

  • System.Net.WebSockets - WebSocket 的实现
  • System.Web.WebSockets - WebSocket 与 ASP.NET 的集成

我还没有看到 System.ServiceModel.WebSockets 但我认为有一些名为 Microsoft.ServiceModel.WebSockets 的原型

I will add little bit more to your confusion. Microsoft.* prefixed assemblies / namespaces are usually either very specific to some language or not part of .NET framework (shipped out of band (or prototypes)).

Assemblies / namespaces shipped with .NET framework usually start with System.*. There are two namespaces containing features related to WebSockets in .NET 4.5:

  • System.Net.WebSockets - implementation of WebSockets
  • System.Web.WebSockets - integration of WebSockets with ASP.NET

I haven't see System.ServiceModel.WebSockets but I think there was some prototype named Microsoft.ServiceModel.WebSockets

抚你发端 2024-12-19 01:22:40

html5labs.interoperabilitybridges.com

...我们未来不打算对此原型进行任何更新。

System.Web.WebSockets

...命名空间包含支持向 ASP.NET Web 表单应用程序添加 WebSocket 功能的类。

Microsoft.Web.WebSockets:

...提供使用 ASP.NET 和 WCF 在 Windows 8 上编写支持 WebSocket 的服务器应用程序的功能


我的结论:

  • System.Net.WebSockets 似乎是低级的东西。
  • 当您使用 ASP.NET 时需要 System.Web.WebSockets Web Forms
  • Microsoft.Web.WebSockets 来自 NuGet 看起来是您使用 ASP 时的最佳选择.NET MVC

html5labs.interoperabilitybridges.com:

...we don't plan any future updates to this prototype.

System.Web.WebSockets:

...namespace contains classes that support adding WebSocket functionality to ASP.NET Web Forms applications.

Microsoft.Web.WebSockets:

...provides functionality for writing WebSocket-enabled server applications on Windows 8 using ASP.NET and WCF


My conclusion:

  • System.Net.WebSockets seems like something low-level.
  • System.Web.WebSockets need when you use ASP.NET Web Forms
  • Microsoft.Web.WebSockets from NuGet looks like best choice when you use ASP.NET MVC
最美的太阳 2024-12-19 01:22:40

@Greg Woods re System.ServiceModel.WebSockets:你没有想象到它。

http://html5labs.interoperabilitybridges.com/media/1165/readme.htm

@Greg Woods re System.ServiceModel.WebSockets: you weren't imagining it.

http://html5labs.interoperabilitybridges.com/media/1165/readme.htm

傻比既视感 2024-12-19 01:22:40

至于 Microsoft.Web.WebSocketsSystem.Web.WebSockets...

我认为:

System.Web.WebSockets - 给你用于处理 websocket 的较低 api

,而...

Microsoft.Web.WebSockets- 是一种较高< /em> api,这使得它更加易于处理,并且还尝试镜像 html5/javascript 规范中的事件/函数(例如 onerror、onopen、onmessage、onclose、send 等...)

As for the Microsoft.Web.WebSockets vs System.Web.WebSockets...

I think that:

System.Web.WebSockets- gives you a lower api for working with websockets

while...

Microsoft.Web.WebSockets- is kind of a higher api, which makes it far more easy to deal with, and also tries to mirroring the events/functions that are in the html5/javascript specification (e.g.- onerror,onopen, onmessage,onclose, send, etc...)

月亮是我掰弯的 2024-12-19 01:22:40

我相信为什么命名为 Microsoft.Web.WebSockets

“此预览包提供了使用 ASP.NET 和 WCF 在 Windows 8 上编写支持 WebSocket 的服务器应用程序的功能。需要 .NET 4.5 RC 和Windows 8 RC。”

它可能是一个 Microsoft.* 命名的库,因为它是针对 Windows 8 RC 开发的。这不是一个可靠的依赖项,因此它不能成为官方 .net 框架的一部分。

当然,一旦 Windows 8 发布,他们就可以依赖它并开始发布 websockets 库作为官方框架的一部分。因此,Microsoft.Web.WebSockets 可能会被有效地废弃,而不会离开预发布状态。

System.Web.WebSocketsSystem.Net.WebSockets 怎么样?

System.Web.WebSockets:“支持向 ASP.NET Web 窗体应用程序添加 WebSocket 功能的类。”

嗯……看起来很简单。这些类旨在从 ASP.NET Web 窗体中使用。他们需要 Windows 8 吗?没有把握。

System.Net.WebSockets:是与 Web 窗体无关的其他东西。但它仅适用于 Windows 8。

Microsoft.ServiceModel.WebSockets

另一个旧的预发布包。这个可以在 Windows 7 上运行!

注意:不用担心在什么平台+框架上使用什么来获取 WebSockets 有点消失,你可以使用 SignalR 来代替,它会选择一个传输并尝试为你做一些类似 websockets 的事情。

This is my belief on why the naming Microsoft.Web.WebSockets:

"This preview package provides functionality for writing WebSocket-enabled server applications on Windows 8 using ASP.NET and WCF. Requires .NET 4.5 RC and Windows 8 RC."

It's probably a Microsoft.* named library because it was developed against Windows 8 RC. Which isn't a solid dependency so it can't be part of the official .net framework.

Of course once Windows 8 comes out they can depend on it and start releasing websockets libraries as part of the official framework. So the Microsoft.Web.WebSockets may be effectively obsoleted without ever leaving prerelease status.

What about System.Web.WebSockets vs System.Net.WebSockets?

System.Web.WebSockets: "classes that support adding WebSocket functionality to ASP.NET Web Forms applications."

Hm... Seems simple. These classes are designed to be used from ASP.NET Web Forms. Do they require Windows 8? Not sure.

System.Net.WebSockets: is something else that isn't tied to Web Forms. But it only works if you have Windows 8.

Microsoft.ServiceModel.WebSockets

Another old prerelease package. This one works on Windows 7!

Note: instead of worrying about what works on what platform+framework to use to get WebSockets kinda goes away you could just use SignalR instead, which will pick a transport and try to do something like websockets for you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文