我尝试ConnectionMultiplexer.ConnectAsync
通过以下方式调用 Blazor 客户端组件:
protected override async Task OnInitializedAsync()
{
var configuration = new ConfigurationOptions
{
AbortOnConnectFail = false,
ConnectTimeout = 3000,
SyncTimeout = 5000,
KeepAlive = 180,
EndPoints =
{
{
"localhost", 6379
}
}
};
await ConnectionMultiplexer.ConnectAsync(configuration);
await base.OnInitializedAsync();
}
这会引发异常:
无法评估孩子
如何StackExchange.Redis
在Blazor WebAssembly
应用程序中使用?
编辑:
我在 VS 输出中发现了更详细的错误消息:
Unhandled exception rendering component: Cannot start threads on this runtime.
System.NotSupportedException:无法在此运行时启动线程。在 System.Threading.Thread.StartInternal(System.Object 主体,System.Threading.StackCrawlMark 和 stackMark)的(包装器托管到本机)System.Threading.Thread.Thread_internal(System.Threading.Thread,System.MulticastDelegate)<0x3b02590 + 0x00008> in :0 at System.Threading.Thread.Start (System.Threading.StackCrawlMark& stackMark) <0x3b02450 + 0x0004e> in :0 at System.Threading.Thread.Start (System.Object 参数) <0x3b022d0 + 0x0003a> in :0 在 Pipelines.Sockets.Unofficial.DedicatedThreadPoolPipeScheduler.StartWorker (System.Int32 id) [0x0003a] 在 C:\Code\Pipelines.Sockets.Unofficial\src\Pipelines.Sockets.Unofficial\DedicatedThreadPoolPipeScheduler.cs:112 在 Pipelines.Sockets .Unofficial.DedicatedThreadPoolPipeScheduler../src/StackExchange.Redis/SocketManager.cs:98 在 StackExchange.Redis.SocketManager..ctor (System.String name, System.Int32 workerCount, System.Boolean useHighPrioritySocketThreads) [0x00000] in //src/StackExchange.Redis/SocketManager .cs:44 在 StackExchange.Redis.SocketManager.get_Shared () [0x0000c] in / /src/StackExchange.Redis/SocketManager.cs:132 在 StackExchange.Redis.ConnectionMultiplexer.OnCreateReaderWriter (StackExchange.Redis.ConfigurationOptions 配置) [0x00000]在 / /src/StackExchange.Redis/ConnectionMultiplexer.ReaderWriter.cs:9 在 StackExchange.Redis.ConnectionMultiplexer..ctor (StackExchange.Redis.ConfigurationOptions 配置) [0x000d6] 在 //src/StackExchange.Redis/ConnectionMultiplexer.cs:1150 在 StackExchange.Redis.ConnectionMultiplexer.CreateMultiplexer(System.Object 配置,StackExchange.Redis.ConnectionMultiplexer+LogProxy 日志,System.EventHandler`1[StackExchange.Redis.ConnectionFailedEventArgs]&connectHandler) [0x0000d] 在 //src/StackExchange.Redis/ConnectionMultiplexer.cs:957 在 /_/src/StackExchange.Redis/ConnectionMultiplexer.cs 中的 StackExchange.Redis.ConnectionMultiplexer.ConnectImplAsync(System.Object 配置,System.IO.TextWriter 日志)[0x0003a]: 854 在 Joker.BlazorApp.Sample.Pages.ProductsComponentBase.OnInitializedAsync () [0x0007c] 在 C:\Users\tomas.fabian\source\repos\Joker.BlazorApp.Sample\Joker.BlazorApp.Sample\Pages\ProductsComponentBase.cs: 52 在 Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync () <0x37da140 + 0x0013a> 在:0