|
1 | 1 | // Licensed to the .NET Foundation under one or more agreements. |
2 | 2 | // The .NET Foundation licenses this file to you under the MIT license. |
3 | 3 |
|
| 4 | +using System.Diagnostics; |
4 | 5 | using System.Globalization; |
5 | 6 | using System.Reflection; |
6 | 7 | using System.Security.Claims; |
@@ -31,31 +32,39 @@ public RazorComponentEndpointsStartup(IConfiguration configuration) |
31 | 32 | public void ConfigureServices(IServiceCollection services) |
32 | 33 | { |
33 | 34 | services.AddValidation(); |
| 35 | + if (Debugger.IsAttached) |
| 36 | + { |
| 37 | + services.AddSignalR(options => |
| 38 | + { |
| 39 | + options.KeepAliveInterval = TimeSpan.FromMinutes(10); // default is 15 seconds |
| 40 | + options.ClientTimeoutInterval = TimeSpan.FromMinutes(20); // must be longer than KeepAliveInterval |
| 41 | + }); |
| 42 | + } |
34 | 43 |
|
35 | 44 | services.AddRazorComponents(options => |
36 | 45 | { |
37 | 46 | options.MaxFormMappingErrorCount = 10; |
38 | 47 | options.MaxFormMappingRecursionDepth = 5; |
39 | 48 | options.MaxFormMappingCollectionSize = 100; |
40 | 49 | }) |
41 | | - .RegisterPersistentService<InteractiveServerService>(RenderMode.InteractiveServer) |
42 | | - .RegisterPersistentService<InteractiveAutoService>(RenderMode.InteractiveAuto) |
43 | | - .RegisterPersistentService<InteractiveWebAssemblyService>(RenderMode.InteractiveWebAssembly) |
44 | | - .AddInteractiveWebAssemblyComponents() |
45 | | - .AddInteractiveServerComponents(options => |
46 | | - { |
47 | | - if (Configuration.GetValue<bool>("DisableReconnectionCache")) |
48 | | - { |
49 | | - // This disables the reconnection cache, which forces the server to persist the circuit state. |
50 | | - options.DisconnectedCircuitMaxRetained = 0; |
51 | | - options.DetailedErrors = true; |
52 | | - } |
53 | | - }) |
54 | | - .AddAuthenticationStateSerialization(options => |
| 50 | + .RegisterPersistentService<InteractiveServerService>(RenderMode.InteractiveServer) |
| 51 | + .RegisterPersistentService<InteractiveAutoService>(RenderMode.InteractiveAuto) |
| 52 | + .RegisterPersistentService<InteractiveWebAssemblyService>(RenderMode.InteractiveWebAssembly) |
| 53 | + .AddInteractiveWebAssemblyComponents() |
| 54 | + .AddInteractiveServerComponents(options => |
| 55 | + { |
| 56 | + if (Configuration.GetValue<bool>("DisableReconnectionCache")) |
55 | 57 | { |
56 | | - bool.TryParse(Configuration["SerializeAllClaims"], out var serializeAllClaims); |
57 | | - options.SerializeAllClaims = serializeAllClaims; |
58 | | - }); |
| 58 | + // This disables the reconnection cache, which forces the server to persist the circuit state. |
| 59 | + options.DisconnectedCircuitMaxRetained = 0; |
| 60 | + options.DetailedErrors = true; |
| 61 | + } |
| 62 | + }) |
| 63 | + .AddAuthenticationStateSerialization(options => |
| 64 | + { |
| 65 | + bool.TryParse(Configuration["SerializeAllClaims"], out var serializeAllClaims); |
| 66 | + options.SerializeAllClaims = serializeAllClaims; |
| 67 | + }); |
59 | 68 |
|
60 | 69 | if (Configuration.GetValue<bool>("UseHybridCache")) |
61 | 70 | { |
|
0 commit comments