浏览器外 silverlight 应用程序与传统桌面应用程序
如果我理解正确的话,Microsoft Silverlight 是一个轻量级 .NET 实现,旨在在客户端浏览器内运行。所以现在我听说“浏览器外”silverlight 应用程序,我很困惑。
与传统的 .NET 桌面应用程序相比,“浏览器外”silverlight 应用程序有什么优势?
If I understand correctly, Microsoft Silverlight is a lightweight .NET implementation meant to run on the client side, inside a browser. So now I hear about "out of browser" silverlight applications and I'm confused.
What is the advantage of an "out of browser" silverlight application, compared to a traditional .NET desktop application?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Silverlight 应用程序的浏览器外安装仍然在安全沙箱中运行,而传统的 .NET 桌面应用程序则不会。
OOB 的目标是使用户能够将基于 Web 的应用程序从其浏览器容器中取出并使其更易于访问。它仍然是一个基于网络的应用程序。值得记住的是,它可以在 Mac 上运行,而传统的 .NET 桌面应用程序则不能。
随着 SL4 OOB 现在可以要求用户提高信任度,这一领域变得更加混乱。现在沙箱更加宽松,并且有更多的机会与本机操作系统一起工作。然而,仍然存在许多限制,主要是为了支持多平台。如果受信任的 OOB 往往只在 Windows 上运行这一事实成为事实,那将是不可取的。是否可以避免这种情况还有待观察。
因此,如果您正在考虑开发一个功能齐全的 Windows 桌面应用程序,那么使用 WPF 可能会更好。另一方面,如果您不需要完全访问操作系统,您可以通过网页交付和/或您希望能够在 Windows 和 Mac(以及可能的其他平台)上运行,那么也许 Silverlight 4 OOB+Elevated信任可能正是您所需要的。
An out-of-browser install of a Silverlight application still runs in a security sandbox where as a traditional .NET desktop application won't.
The objective of an OOB is to give the user the ability to lift a web-based application out of its browser container and make it easier to access. Its still a web based application. Its worth bearing in mind that this works on a Mac where as a traditional .NET desktop app won't.
This area has become muddier with SL4 OOB that can now ask the user for elevated trust. Now the sandbox is more relaxed and there are greater opportunities to work with the native OS. However there are still many restrictions in place primarily to support multi-platforms. It would not be desirable if it became a defacto that trusted OOBs tend only to work on Windows. It remains to be seen whether that can be avoided.
So if you're thinking of a full-fledge Windows desktop app then you're probably better off using WPF. On the other hand if you don't need full access to the OS, you can deliver via a web page and/or you want to be able run on both Windows and Macs (and possibly other platforms) then perhaps Silverlight 4 OOB+Elevated Trust may be what you need.
Silverlight 3 浏览器外应用程序允许任何 Silverlight 应用程序拥有桌面快捷方式,并且不需要打开浏览器来运行应用程序(因此从技术上讲,即使您处于离线状态,您现在也可以运行该应用程序,因为您不必通过网络获取 SL 应用程序)。
借助 SL 4,您现在可以拥有提升的权限,允许 SL 应用程序访问本地资源(例如网络堆栈和文件系统)。
还有一个简单的 API 调用,用于浏览器外 SL 应用程序在启动时检查更新,并从服务器下载更新。这可以被视为类似于单击一次部署,但它会自动快速发生,因此比单击一次更高效、更直接。
与传统的 .NET 应用程序(在本例中让我们与 WPF 进行比较,因为它实际上是 WinForms 的替代品)相比,安装方式非常少。没有安装程序,只有 xap 文件,可以轻松托管在网络上并且安装速度非常快。 SL 使用简化的 .NET 框架,这似乎是一个缺点。然而,SL 应用程序的典型模式是将大部分繁重工作放在服务层中。然后,在服务层中,您拥有完整的 .NET 框架,并且几乎可以执行您想做的任何操作(例如使用 ADO.NET 访问数据库)。
Silverlight 3 out-of-browser apps allow any Silverlight app to have a desktop shortcut, and don't require the browser to be opened to run the app (so technically you could now run the app even if you're offline, since you don't have to fetch the SL app via the web).
With SL 4, you can now have elevated privileges, allowing the SL app to access local resources (such as the network stack and file system).
There's also a simple API call for an out-of-browser SL app to check for updates on startup, and download an update from the server. This could be seen as similar to click-once deployment, but it happens automatically and quickly, so it's more efficient and straightforward than click-once.
Compared to a traditional .NET app (in this case let's compare with WPF, since that's effectively the WinForms replacement), there's very little in the way of installation. No setup program, just the xap file, easily hosted on the web and very quickly installable. SL uses a reduced .NET framework, which might seem like a negative. However, the typical pattern for an SL app is to put most of the heavy-lifting in a service tier. Then, in the service tier you have the full .NET framework and can do pretty much whatever you want (such as accessing databases with ADO.NET).
库是这两个应用程序之间需要考虑的另一件事。例如,Silverlight 4 本身内置了对开箱即用的网络摄像头和麦克风通话的支持,而 WPF 和完整的 .net 框架有一个非常大的第三方库社区可供利用,您可能需要源代码如果您想在 Silverlight 下重建它们。
另一个因素是沙箱的限制,例如,您无法编写可以使用 Silverlight 4 中的任何套接字连接到任何服务器的应用程序。
Libraries are another thing to consider between the two applications. For example, Silverlight 4 natively has built in support for talking to a web-camera and microphone out of the box while WPF and the full .net Framework have a very large third party community of libraries to draw upon which you might need source code for if you wish to rebuild them under Silverlight.
Another factor is limitations in the sandbox, for example, you wouldn't be able to write an application that could connect to any server using any socket in Silverlight 4.