[00:00:06] And in this session, we're going to use [00:00:07] .NET 11 to build fast, resilient, and [00:00:11] scalable web apps using Blazor Server. [00:00:15] Now, for many web apps, rendering from [00:00:17] the server enables you to deliver more [00:00:19] with less. You get more useful content [00:00:22] sooner with less application code for [00:00:25] the browser to have to download and run. [00:00:28] The data and business logic often [00:00:30] already lives on the server. Rendering [00:00:32] there lets us use those services [00:00:34] directly [00:00:35] without a separate browser-facing API [00:00:37] for every operation. [00:00:38] Authorization and validation can stay [00:00:40] close to that data. [00:00:43] Things like reading an article, checking [00:00:45] an order, or submitting a return can fit [00:00:48] often into an ordinary HTTP request. The [00:00:50] server sends useful HTML without waiting [00:00:53] for a browser-side app to to start. You [00:00:55] complete the request, and then you [00:00:57] release the rendered resources. Public [00:01:00] content in that response can then also [00:01:02] be cached, which makes your app more [00:01:04] more efficient. [00:01:06] For richer interactions, the server can [00:01:08] keep the user's working state and then [00:01:10] send UI updates over a real-time [00:01:12] connection. [00:01:13] Rendering on the server can mean a [00:01:15] simpler application to build a simpler [00:01:17] application to build and less work for [00:01:20] the for the browser to do. [00:01:22] Now, Blazor is a great fit for building [00:01:25] server-rendered web apps. The Blazor [00:01:27] component model supports both [00:01:29] request-based pages and rich server-side [00:01:32] interactivity. So you can choose [00:01:34] what each part of your application [00:01:36] needs. [00:01:37] For request-based experiences, Blazor [00:01:39] supports static server-side rendering. [00:01:42] The server renders components to HTML [00:01:45] and then completes the HTTP request. [00:01:47] There's no persistent connection. [00:01:49] For richer workflows, Blazor supports [00:01:51] interactive server-side rendering. [00:01:54] Components [clears throat] can run on [00:01:55] the server, and their working state is [00:01:57] held in what we call [00:01:59] Uh, Blazer events and UI updates travel [00:02:02] over a persistent real-time connection [00:02:04] with the browser. [00:02:05] Uh, Blazer also supports Web Assembly [00:02:07] when code should run, you know, [00:02:09] client-side in the browser. That's good [00:02:10] for like local computation, interactions [00:02:14] that you want to have happen without a [00:02:15] network round trip, and also when you [00:02:17] want to be able to to work offline. [00:02:19] Uh, Web Assembly components can also be, [00:02:21] however, pre-rendered. So HTML first [00:02:24] delivery isn't just exclusive to Blazer [00:02:26] Server. You can take advantage of it [00:02:27] with Blazer Web Assembly as well. The [00:02:29] key difference is then where that [00:02:31] interactive code runs. [00:02:34] Now Blazer already has rich support for [00:02:37] static server-side rendering or static [00:02:39] SSR uh with enhanced navigation and [00:02:41] enhanced form handling. In .NET 11 we [00:02:44] build on that foundation uh making more [00:02:47] workflows possible without an [00:02:48] interactive circuit. [00:02:50] Enhanced navigation um smooths out page [00:02:53] navigations by fetching the next page [00:02:56] and updating the the DOM without a full [00:02:59] page reload. Kind of feels like a spa [00:03:01] even though you're still rendering from [00:03:02] the from the server. In .NET 11 the [00:03:04] Blazer built-in quick grid component now [00:03:07] supports static server-side rendering. [00:03:08] You can be you you can use sorting and [00:03:10] pagination [00:03:12] with static SSR uh using normal links [00:03:15] and request URLs. [00:03:16] .NET 11 also adds uh client-side form [00:03:19] validation support and component [00:03:22] parameters supplied from temp data and [00:03:25] session state. [00:03:26] A form can give immediate feedback, [00:03:28] redirect to a one-time confirmation, and [00:03:31] then also remember a request reference [00:03:33] all without having to set up a circuit [00:03:36] or a persistent connection. [00:03:38] The new cache view component can cache a [00:03:40] reusable region. [00:03:41] The page output caching can reuse an [00:03:44] entire response. [00:03:46] Caching response content on the server [00:03:47] can dramatically improve your site [00:03:49] efficiency. [00:03:50] All right. [00:03:51] Let's turn these features, these new [00:03:53] static server-side rendering features [00:03:55] into a customer experience. [00:03:59] Okay, so over here I have a uh customer [00:04:02] care website, our e-shop customer care [00:04:05] site, and we have a customer who is [00:04:07] having a problem with their uh their [00:04:09] docking station. It's keeps [00:04:10] disconnecting from their monitors and [00:04:12] they're trying to figure out what to do. [00:04:13] So they're looking through all the help [00:04:14] content on the this site. Now this site [00:04:17] this these pages on the the customer [00:04:19] care site, these are all implemented [00:04:20] using just static server-side rendering. [00:04:22] There's no interactive rendering [00:04:23] happening here. If you don't believe me, [00:04:25] I'll bring up the uh the browser dev [00:04:27] tools and we can go in here. Let's let's [00:04:30] refresh the page. Make sure we don't [00:04:32] have any uh [00:04:33] uh filtering going on. We don't. Okay, [00:04:35] let's refresh the page. And then if we [00:04:37] look at just web sockets, let's filter [00:04:39] just the web sockets. Okay okay. So [00:04:40] there is there is one web socket, but [00:04:42] this is the browser link web socket from [00:04:44] Visual Studio. That's for tooling. [00:04:45] There's no Blazer web socket set up for [00:04:47] this site. So it's just using static [00:04:49] server-side rendering. But it it it's uh [00:04:51] it's fast, it's smooth. Like as I [00:04:52] navigate around, I can see the the help [00:04:54] library. I can go to these different [00:04:56] articles. I can go through the [00:04:58] pagination. I can sort these articles. I [00:05:01] can um fill um uh you know paginate and [00:05:04] sort. All of these interactions that you [00:05:06] just saw are being done using static [00:05:08] server-side rendering. Now this uh help [00:05:10] library, this is actually the Blazer [00:05:12] QuickGrid uh component, which like I [00:05:13] said before, now supports static static [00:05:16] SSR. [00:05:18] I thought it did. Did I not Sorry, did I [00:05:20] not escape out of PowerPoint? [00:05:23] Oh oh oh, I bet I'm [00:05:26] uh sorry, people can't see what I'm [00:05:27] showing. [00:05:28] How about that? Is that better? [00:05:30] [laughter] [00:05:31] Sorry, I was extending my screen instead [00:05:33] of duplicating. All right, so um this is [00:05:35] a website, customer care website. Like [00:05:36] we said, it's all built with static SSR. [00:05:39] You know, earlier I showed that there's [00:05:40] there's no web sockets here. I'll also [00:05:41] refresh again. Uh and yeah, so the only [00:05:44] web socket that we're seeing is the uh [00:05:46] the browser link web socket from Visual [00:05:47] Studio. So this is just being uh [00:05:49] rendered statically from the server, but [00:05:51] it's fast and smooth. Like we can browse [00:05:53] around, we can look at the help library, [00:05:55] click on these articles, go back. We can [00:05:58] paginate our QuickGrid component, uh [00:06:00] sort the columns, all doing using done [00:06:02] using static SSR. So QuickGrid is using, [00:06:04] you know, the URL uh to set up different [00:06:06] page navigations to change its state, [00:06:08] and then enhanced navigation is just [00:06:10] kicking in, so everything feels uh fast [00:06:12] and smooth. It's worth also noting that [00:06:14] if we uh scroll down here to the bottom, [00:06:18] okay, so down here you can see there [00:06:19] these um timestamps, like there's a [00:06:21] timestamp for the outer content, and [00:06:23] there's also a timestamp stamp for the [00:06:24] uh quick grid base content. If I F5 the [00:06:27] browser a bunch of times, you see how [00:06:29] the uh outer content is refreshing, but [00:06:31] the inner content is just staying the [00:06:33] same. Why is that? That's because it's [00:06:35] being cached. It's we're using the new [00:06:37] uh cache view [00:06:39] component in .NET 11 to cache that [00:06:41] content. Let's go Let's go take a look. [00:06:42] So, here's the the quick grid, and [00:06:44] you'll notice that, you know, this this [00:06:45] doesn't look any different from when you [00:06:46] would normally use uh quick grid. Uh [00:06:49] everything The code looks exactly the [00:06:50] same. That's the beauty of the Blazer [00:06:52] component model. You just write your [00:06:53] components once and then you can use [00:06:54] them in all the different various ways. [00:06:57] And then if we look at the page that's [00:06:58] hosting that uh customer help library [00:07:00] component that has the quick grid, [00:07:02] that's where we're seeing the new cache [00:07:04] view component. You can see that it's uh [00:07:06] got various vary by uh parameters [00:07:08] varying by various query string [00:07:09] parameters, all the ones that quick grid [00:07:10] is using. And then over on the side, we [00:07:12] can see that it has an expiration set [00:07:14] for about uh 2 minutes. So, if I waited [00:07:16] 2 minutes and kept refreshing, we would [00:07:18] eventually see the uh the quick grid [00:07:19] also update as well. [00:07:21] Now, on the um [00:07:23] the cust that uh returns policy page, [00:07:26] like this page here, this is also using [00:07:28] caching. You can see down at the bottom [00:07:29] that it's uh got a a render time. And if [00:07:33] I zoom in again and, you know, refresh a [00:07:34] bunch of times as well, you know, [00:07:35] doesn't doesn't change. That's because [00:07:37] it's being cached. Um that page is [00:07:40] actually using the uh This just just the [00:07:42] standard uh [00:07:44] output cache attribute, and that will [00:07:46] allow us to cache the the whole [00:07:47] response. So, that'll be uh cache that's [00:07:49] sort of at the HTTP level, while the new [00:07:52] cache view component, that will cache [00:07:53] like the component instances and also um [00:07:57] uh put them in in memory or use the [00:07:59] hybrid cache if one is configured uh for [00:08:01] for for for for saving persisting that [00:08:03] cached data. [00:08:05] Okay, so that's great. Now, let's say [00:08:07] our user, you look through all these [00:08:08] help documentation, go back to the help [00:08:10] library, couldn't find something to [00:08:11] resolve their monitor not connecting to [00:08:13] their docking station issue. They're [00:08:14] going to need to submit a a support [00:08:16] ticket. So let's go ahead and do that. [00:08:19] So here we have a form. Again, still [00:08:20] static server-side rendering. If I mess [00:08:22] up like my my email address here and tab [00:08:25] out, you can see that I immediately get [00:08:26] validation feedback. So we're getting [00:08:28] client-side validation even though this [00:08:30] is not an interactively rendered form. [00:08:32] And that's because in .NET 11 we added [00:08:34] support for client-side validation with [00:08:36] static server-side rendering. We just [00:08:37] added that logic to Blazor.web.js using [00:08:40] a modern client-side [00:08:43] JavaScript-based implementation. So I [00:08:45] fixed this again, then that validation [00:08:47] error should resolve. Okay, we can go [00:08:49] ahead and say what the problem is. My [00:08:51] dock [00:08:53] won't connect. [00:08:55] I have a presentation [00:08:59] tomorrow. And then we can go ahead and [00:09:01] submit this. Now when we submit this, [00:09:04] this will be a normal [00:09:05] form post, but it'll be an enhanced form [00:09:07] post. And then we get it does a post [00:09:09] redirect get and we get to this [00:09:10] acknowledgement page. Notice we get a [00:09:11] nice little message here saying thanks [00:09:13] Alex, got your message. If I refresh [00:09:15] this page, notice that that message goes [00:09:17] away. That's because that's using temp [00:09:19] data. The request ID, that stays. That's [00:09:22] being stored in session state. So if we [00:09:25] go back to the code and let's look at [00:09:26] how that request form is being [00:09:29] implemented. Up above we can see the [00:09:30] form. It's just a normal edit form. If [00:09:33] we scroll We can just look see it over [00:09:35] here on the side. This form is enhanced. [00:09:37] So it will be the post will be [00:09:38] intercepted, swapped in for a fetch [00:09:40] request, and then Blazor will do the [00:09:42] rendering from the server and [00:09:43] inject the the updates into the DOM. [00:09:46] Down below we can see that here's where [00:09:48] we're getting the the form data, but [00:09:50] then below that we can also get [00:09:52] parameters for binding to temp data and [00:09:55] also to to session state. All right, so [00:09:57] those are just properties that can be [00:09:58] populated or read from. When we do that [00:10:00] redirect get we can then read out those [00:10:02] properties here to get the updated [00:10:04] message. And then down below we're like [00:10:06] clearing out the message so that it's [00:10:07] only read once when you're getting out [00:10:09] of data. Okay? So that's the client side [00:10:12] validation support as well as temp data [00:10:14] and support for session state. [00:10:21] Oh, [00:10:22] wait on. Escape out. Forgot to show one [00:10:24] other thing in the form that's really [00:10:25] neat. In this form up above, yeah, a [00:10:28] couple new components. So when we're [00:10:30] setting up the labels for the form, [00:10:31] notice that we're using the new built-in [00:10:33] label component. Let me zoom in a little [00:10:35] bit more so you can see that. [00:10:38] There you go. So new label component. [00:10:39] That will look at the the property on [00:10:42] your model and get the display name off [00:10:43] of it and then properly set up the the [00:10:45] label tag for you. [00:10:47] Under the covers, that's using the new [00:10:49] display name component, which is up [00:10:51] here. Very similar. This will look at [00:10:53] the the model property, get its display [00:10:55] name, and then it just returns it [00:10:56] without actually generating a label. So [00:10:58] new components there as well that you [00:10:59] can use for for both static server side [00:11:01] rendering and also for interactive [00:11:02] rendering too. [00:11:04] Great. Didn't miss that. [00:11:07] Okay. Now our customer service [00:11:09] representative handling the support [00:11:11] case, they're going to need, you know, [00:11:13] richer interactions. [00:11:15] But we also want to still keep the [00:11:17] application logic on the server. [00:11:19] That's where interactive server side [00:11:20] rendering really comes in and shines. [00:11:22] Interactive server side rendering [00:11:24] handles user interactions in the browser [00:11:26] from the server over a real time [00:11:28] connection. Now by default, Blazer will [00:11:31] pre-render HTML that the browser can [00:11:33] display before the interactivity is [00:11:35] ready. The browser then connects after [00:11:37] you get the HTML, you load the Blazer, [00:11:40] and it can connect back to the server. [00:11:41] Blazer creates the interactive [00:11:43] components, component instances on the [00:11:45] server, and then browser events then get [00:11:47] dispatched to your components and Blazer [00:11:49] sends back the the UI updates. [00:11:52] Now note [00:11:54] Now note [00:11:56] that [00:11:58] my goodness. [00:11:59] Why do we keep [00:12:02] Now note that the component instances [00:12:04] used to pre-render and the ones used for [00:12:06] interactivity, those are those are [00:12:08] actually separate instances. So [00:12:10] initialization can will will generally [00:12:12] run twice. And the pre-rendered data, [00:12:15] the any data you're using for [00:12:16] pre-rendering doesn't automatically [00:12:17] carry over. Persistent component state [00:12:21] connects those two pieces. [00:12:24] So persistent component state lets [00:12:26] interactive instances reuse selected [00:12:29] data from pre-rendering without having [00:12:31] to refresh it refresh it. What you do is [00:12:33] you can mark a a property that's [00:12:35] serializable with the persistent state [00:12:36] attribute and then set it only if it [00:12:39] hasn't been restored with a value. The [00:12:41] pre-rendered instance then sets and [00:12:43] persists the value. [00:12:45] The interactive instance then receives [00:12:46] that value and skips the loading because [00:12:48] it's already there and that that way you [00:12:50] only load the the data once. This is a [00:12:52] feature that was actually made available [00:12:53] in .NET 10, but it's a basis for some of [00:12:55] the other features that we're going to [00:12:56] see. So let's see it in action. [00:12:58] Okay, here we go. [00:13:02] All right, so back in the application, [00:13:05] let's now go to the site for the our [00:13:07] customer support rep who's going to be [00:13:09] handling this case. Let's go ahead and [00:13:10] have him log in. All right, so let's [00:13:12] see. Let's look at the support case. And [00:13:15] here we have the ability to see the [00:13:17] case. Yep, you know, docking station [00:13:19] won't connect. [00:13:20] And the we have the ability to just give [00:13:22] it a refund or replacement or whatever. [00:13:24] Now, this is a an interactive page. [00:13:26] We're actually using interactive [00:13:27] server-side rendering here so that we [00:13:28] can have that rich interactive [00:13:30] experience. And it's going to get [00:13:31] pre-rendered before it's interactive. [00:13:33] And we don't want to retrieve all the [00:13:35] data for this support ticket twice. So [00:13:38] how can we set that up? So over in in [00:13:40] Visual Studio, let's look at the code. [00:13:42] So here is the [00:13:46] let's see, return details page. Yes, [00:13:48] okay, right here. So this is where we're [00:13:53] setting up [00:13:54] the the all the the details for the the [00:13:57] that support case and any return that [00:13:59] we're going to do. And down below, you [00:14:00] can see right here, we're taking the [00:14:02] state for that page and we're marking it [00:14:04] as persistent. So this can be [00:14:06] persistent. So when the page gets [00:14:09] pre-rendered, that state will be [00:14:10] persisted onto the page so that it can [00:14:12] be [00:14:12] reused when the app becomes interactive. [00:14:15] Now, how can see that that's actually [00:14:17] happening? Well, I added in the in the [00:14:18] data loader where we're like [00:14:19] initializing the the initial set of [00:14:21] state that we're going to persist. Uh we [00:14:23] had a little logging statement in here [00:14:25] to say like uh that we just loaded the [00:14:27] context and how many times that we've [00:14:28] done that. So we should be able to go [00:14:30] over into Aspire and look at the uh [00:14:34] structured logs for our service. [00:14:38] And let's look for that resolution [00:14:40] context load. Yeah, right here. You can [00:14:43] see that it is showing up once in our [00:14:45] logs and it's only been loaded once. We [00:14:47] don't see it being loaded twice. So if [00:14:49] you're seeing your components load [00:14:50] twice, that might be because of [00:14:51] pre-rendering and persisting the state [00:14:52] using this technique can be a way that [00:14:54] you resolve that. It also makes your app [00:14:56] faster and more efficient because you're [00:14:57] not having to fetch that data twice. [00:15:05] Okay. Now, we've covered making your app [00:15:07] fast using static server-side rendering, [00:15:10] using uh persistent component state and [00:15:11] pre-rendering. Um now let's take a look [00:15:15] at making your app more resilient. Uh [00:15:17] resilient in particularly in the face of [00:15:19] uh lost connections. Interactive Blazor [00:15:21] Server [00:15:22] uh needs a connection to be able to [00:15:24] handle events. Uh when that connection [00:15:26] drops, uh Blazor will show like a [00:15:28] reconnection UI and it will try to [00:15:30] reconnect. The server temporarily will [00:15:32] keep that circuit in memory and if the [00:15:34] users reconnects during that window, um [00:15:37] they will return to that same component [00:15:38] instance and the the state that they had [00:15:40] before, return to that same circuit. [00:15:42] But of course the server can't hold on [00:15:43] to that disconnected uh circuit forever. [00:15:45] Eventually it needs to free up those [00:15:47] resources. But what it will do is before [00:15:49] it evicts the the circuit, it will [00:15:51] persist it if the and if the components [00:15:53] have been set up with persistent state, [00:15:56] then that uh state can be reused to then [00:15:58] uh resume that circuit later with a new [00:16:00] uh with a new circuit. [00:16:03] So if the user then comes back after [00:16:04] their connection's been dropped and [00:16:05] they're able to to connect back to the [00:16:07] server finally, Blazor can restore the [00:16:09] snapshot into a new circuit and the user [00:16:11] gets a uh seamless on on uninterrupted [00:16:13] experience. So let me show you that [00:16:15] working. [00:16:16] Come on in [00:16:18] Go back to app. [00:16:20] And let's go back to the actual [00:16:21] application. Okay, so here is um [00:16:24] All right, we're on again that [00:16:24] interactive page. And now what we're [00:16:26] going to do, let's actually snap this [00:16:29] side by side with a spire and let's look [00:16:31] at the Aspire metrics. [00:16:33] Okay, and down where somewhere here we [00:16:34] should be able to see how many circuits [00:16:35] we have in our app. Yeah, right here we [00:16:37] can see the number of active circuits [00:16:39] and the number of connected ones and [00:16:40] they're both currently one, right? Okay, [00:16:42] now what I'm going to do in the app is [00:16:43] I'm going to bring up the browser dev [00:16:44] tools and I'm going to [00:16:46] kill the connection. I'm going to say [00:16:47] that this app is now offline. [00:16:50] So that should um [00:16:53] set the [00:16:55] end the connection so pretty soon Blazer [00:16:57] should detect that has happened. [00:17:00] There it goes. Okay, so we're we're [00:17:02] offline. We're not able to connect to [00:17:04] the server, so Blazer's trying to [00:17:05] reconnect. And now eventually the the [00:17:08] server will [00:17:09] kind of give up that the user is going [00:17:10] to reconnect and will get rid of their [00:17:12] circuit. So that yeah, there right now [00:17:13] we see we have zero connected circuits. [00:17:15] So the server detected it in our in our [00:17:17] metrics. And eventually the server is [00:17:18] going to evict that circuit and say [00:17:19] like, you know what, they're not coming [00:17:20] back. [00:17:21] Normally this would be two minutes, but [00:17:23] for the demo I shortened down. Yeah, so [00:17:24] now we have zero active circuits on the [00:17:26] server at all. Now fortunately before [00:17:28] Blazer evicted that circuit, it also [00:17:31] persisted it. So we should still be able [00:17:33] to reconnect again and get our state [00:17:35] back. So if I set the network now to no [00:17:38] throttling, so that we're back online [00:17:40] again and give it a second to reconnect, [00:17:42] we should be good. And then all the [00:17:43] state that we had before and whether we [00:17:45] had a replacement and what the [00:17:46] replacement model was, which we didn't [00:17:47] have one selected, but the the delivery [00:17:49] address, none of that was lost cuz all [00:17:51] of it got got persisted. So that's how [00:17:53] you can be resilient in the face of [00:17:55] connection loss leveraging that [00:17:56] persistent component state feature. [00:18:04] Okay, now connection loss isn't the only [00:18:06] way that things can get interrupted. A [00:18:08] planned server replacement can interrupt [00:18:10] work too. Now in .NET 11 you can trap [00:18:13] the connected circuits on the server [00:18:14] through a circuit handler and then use a [00:18:16] new API that we just added the request [00:18:18] circuit pause async API uh to basically [00:18:21] shut uh uh persist those circuits before [00:18:23] they get uh uh shut down and uh before [00:18:26] the server gets fully shut down. [00:18:28] And when pausing that that circuit the [00:18:30] state will be stored and this says [00:18:31] because you have a connection to the [00:18:32] client it can actually be stored client [00:18:34] side instead of storing it on the [00:18:35] server. [00:18:36] Uh note that uh an accepted request to [00:18:39] pause the circuit does not mean the [00:18:40] circuit is actually fully paused yet so [00:18:42] you actually also need to give a little [00:18:43] a little time a little delay uh to allow [00:18:45] that pause to to complete. [00:18:47] So this is how it works. We have a [00:18:48] server uh that you want to uh you know [00:18:51] bring down and bring up like do a new [00:18:52] deployment. What you first do is you [00:18:54] stop traffic to that to that server so [00:18:56] you can't create new connections and [00:18:58] then you take all the existing [00:18:59] connections that you still have alive [00:19:01] and you uh keep track of them and you [00:19:03] ask them all to to pause. Give them a [00:19:05] little bit of time to do so and then you [00:19:06] should be able to be safe to to bring [00:19:08] down that server do an update and then [00:19:10] bring it up again. All those uh paused [00:19:12] clients should then be able to reconnect [00:19:13] and resume using their their persisted [00:19:16] state. Let's see if we can get that to [00:19:18] happen actually uh in action. [00:19:21] Okay so back in the application. [00:19:24] So now what I want to do uh we want to [00:19:26] actually uh you know shut down the [00:19:28] server for like a for an update. So [00:19:29] we're back on our our interactive page. [00:19:31] We've got one circuit and I've got this [00:19:32] little like service operations page [00:19:34] where I can ask the server to to shut [00:19:37] down but I want to shut down gracefully [00:19:38] so I don't lose the state here in the in [00:19:41] the applet. Let's go ahead and select uh [00:19:43] like a docking station as our [00:19:44] replacement model maybe change this to [00:19:46] like .NET comp so we can see that we're [00:19:48] not actually losing any of this stuff. [00:19:49] Okay? So let's stop the service [00:19:51] gracefully. Okay so now you can see that [00:19:53] uh my uh [00:19:55] my application has been asked to to [00:19:56] pause so it's no longer running and if [00:19:58] we go to back to Aspire [00:20:01] and go to the overview page we should [00:20:02] see that the app the the server was [00:20:05] actually fully shut down like it's [00:20:06] finished you know you have to restart it [00:20:07] like it's not actually even running [00:20:09] anymore. Let's go ahead and and imagine [00:20:11] we did our deployment that started up [00:20:12] again. [00:20:13] Wait for it to be to be warm and green [00:20:15] and healthy and now we should be able to [00:20:17] resume [00:20:19] and we're able to reload our persisted [00:20:21] state. Notice we didn't lose any of it [00:20:22] when we set up a new, a new circuit, and [00:20:24] we're good to go. Okay? So that's how [00:20:26] you can make your app resilient in the [00:20:27] face of like server updates. [00:20:33] Lastly, [00:20:34] we [00:20:35] you know, we've we've done a bunch of [00:20:36] work to preserve work through unexpected [00:20:39] connection loss and plan server [00:20:41] maintenance. Now let's look at how we [00:20:43] can make our server more scalable. [00:20:46] Now a live circuit is useful when it's [00:20:48] actually being used for something. [00:20:50] When a user steps away and isn't using [00:20:51] the app, that circuit just stays on the [00:20:53] server and uses server resources without [00:20:55] helping them. In .NET 11 we added a new [00:20:57] auto pause feature that can release [00:20:59] eligible circuits that aren't being [00:21:01] used. Like imagine the the tab is is not [00:21:03] even visible, so the circuit's not [00:21:04] actually being active. We can [00:21:06] automatically pause those circuits and [00:21:08] free up those resources. When the user [00:21:10] comes back their persisted [00:21:13] pause circuit can be resumed and they're [00:21:15] able to continue their work without even [00:21:16] noticing the interruption. [00:21:19] So the way this works is there's a [00:21:20] package that you need to add, the auto [00:21:21] pause package, and then you just [00:21:23] configure it on your for for your Razor [00:21:25] components using the the browser [00:21:27] options. So I'll show you this. It's my [00:21:29] last demo. [00:21:30] Escape. [00:21:32] And then [00:21:34] let's see. Okay, so we've got our app. [00:21:35] Let's go back to the metrics. [00:21:37] And let's go back to see how many [00:21:38] circuits we got. Currently we have one [00:21:40] active circuit and it's connected. Now [00:21:42] I've already oh in the in the code I've [00:21:43] already set up auto pause. Like if we [00:21:45] look at our package dependencies down [00:21:48] here [00:21:49] yeah, there it is. So you can see [00:21:50] there's the auto pause package that I've [00:21:52] set up and I've correctly configured in [00:21:53] the application. [00:21:54] And actually you know I might have [00:21:56] already done it because I just hid the [00:21:58] hid the tab. So okay, so that's now take [00:22:00] the tab and we're just going to hide it. [00:22:01] We're just going to minimize it. And I [00:22:03] think I set the the hidden timeout to [00:22:04] about 8 seconds or so. So if we watch [00:22:06] the the circuit counts we should soon [00:22:08] see that [00:22:10] we no longer have an active circuit [00:22:11] because it automatically got paused. [00:22:15] Just give it a second or so to do that. [00:22:21] And [00:22:22] there it goes. Okay, so we freed up [00:22:24] those server resources, not using that [00:22:26] circuit, so might as well pause it. And [00:22:28] then if we bring up back up the tab, so [00:22:30] now it's visible again. Blazer detects [00:22:32] that the tab is now visible. Ah, and now [00:22:33] we got a new circuit. And again, we [00:22:35] didn't lose any of our state. We still [00:22:36] have all the properties that we had set [00:22:38] previously. Okay? So that's how you can [00:22:40] make your your apps more scalable [00:22:43] using the new auto pause feature in .NET [00:22:45] 11. [00:22:46] Cool. So we just saw how .NET 11 helps [00:22:48] you build Blazer server apps that are [00:22:50] fast, resilient, and scalable. We saw [00:22:52] enhanced support for static server-side [00:22:54] rendering. We saw app resilience in the [00:22:56] face of connection loss and server [00:22:57] deployments, and we were able to [00:22:59] automatically free up server resources [00:23:01] by pausing unused circuits. That's how [00:23:03] Blazer server helps you build web apps [00:23:05] that do more with less. So go ahead, [00:23:08] take the next step. Go ahead and [00:23:09] download .NET 11 at get.net/11 [00:23:12] and start building your next great [00:23:13] Blazer web app today.