.NET Core 3.0方案中的Blazor服务器和性能

Blazor Server是.NET Core 3.0中的一个框架,用于在服务器上托管Blazor组件,通过SignalR实现实时交互。适合在网络连接稳定且对即时更新要求不高的场景。Blazor WebAssembly则在客户端运行,利用WebAssembly执行.NET代码,适用于需要离线支持和充分利用客户端资源的情况。两者皆可与现有.NET项目结合,提供了在Web开发中的灵活性。
摘要由CSDN通过智能技术生成

什么是Blazor服务器? (What is Blazor Server?)

Blazor Server apps host Blazor components on the server and handle UI interactions over a real-time SignalR connection. As the user interacts with the app, the UI events are sent to the server over the connection to be handled by the various components that make up the app. When a component handles a UI event, it’s rendered based on its updated state. Blazor compares the newly rendered output with what was rendered previously and send the changes back to the browser and applies them to the DOM.

Blazor服务器应用程序在服务器上托管Blazor组件,并通过实时SignalR连接处理UI交互。 当用户与应用程序交互时,UI事件通过连接发送到服务器,由组成应用程序的各种组件处理。 当组件处理UI事件时,将根据其更新状态进行呈现。 Blazor将新渲染的输出与先前渲染的输出进行比较,然后将更改发送回浏览器,并将其应用于DOM。

Since Blazor Server apps run on .NET Core on the server, they enjoy all the benefits of running on .NET Core including great runtime performance and tooling. Blazor Server apps can leverage the full ecosystem of .NET Standard libraries without any browser imposed limitations.

由于Blazor Server应用程序在服务器上的.NET Core上运行,因此它们享受在.NET Core上运行的所有好处,包括出色的运行时性能和工具。 Blazor Server应用程序可以利用.NET Standard库的完整生态系统,而不受任何浏览器的限制。

我什么时候应该使用Blazor Server? (When should I use Blazor Server?)

Blazor Server enables you to add rich interactive UI to your .NET apps today without having to write JavaScript. If you need the interactivity of a single-page app in your .NET app, then Blazor Server is a great solution.

Blazor Server使您能够立即将丰富的交互式UI添加到.NET应用程序中而无需编写JavaScript。 如果您需要.NET应用程序中单页应用程序的交互性,那么Blazor Server是一个很好的解决方案。

Blazor Server can be used to write completely new apps or to complement existing MVC and Razor Pages apps. There’s no need to rewrite existing app logic. Blazor is designed to work together with MVC and Razor Pages, not replace them. You can continue to use MVC and Razor Pages for your server-rendering needs while using Blazor for client-side UI interactions.

Blazor Server可用于编写全新的应用程序或补充现有的MVC和Razor Pages应用程序。 无需重写现有的应用逻辑。 Blazor旨在与MVC和Razor Pages一起使用,而不是替换它们。 在使用Blazor进行客户端UI交互时,您可以继续使用MVC和Razor页面来满足服务器渲染的需求。

Blazor Server works best for scenarios where you have a reliable low-latency network connection, which is normally achieved when the client and server are geographically on the same continent. Apps that require extremely high fidelity instant updates on every tiny mouse twitch, like real-time games or drawing apps, are not a good fit for Blazor Server. Because Blazor Server apps require an active network connection, offline scenarios are not supported.

Blazor Server最适用于您具有可靠的低延迟网络连接的方案,通常,这在客户端和服务器位于同一大陆的地理位置时可以实现。 需要对每个微小的鼠标轻触进行极高保真度即时更新的应用程序,例如实时游戏或绘图应用程序,都不适合Blazo

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值