【发布时间】:2020-06-15 21:08:38
【问题描述】:
我尝试通过以下方式在 Blazor 客户端组件中调用 ConnectionMultiplexer.ConnectAsync:
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();
}
这会引发异常:
无法评估孩子
如何在Blazor WebAssembly 应用程序中使用StackExchange.Redis?
编辑:
我在 VS 输出中发现了更详细的错误消息:
Unhandled exception rendering component: Cannot start threads on this runtime.System.NotSupportedException:无法在此运行时启动线程。 在(包装器托管到本机)System.Threading.Thread.Thread_internal(System.Threading.Thread,System.MulticastDelegate) 在 System.Threading.Thread.StartInternal(System.Object 主体,System.Threading.StackCrawlMark 和 stackMark) 在:0 在 System.Threading.Thread.Start (System.Threading.StackCrawlMark& stackMark) in :0 在 System.Threading.Thread.Start(System.Object 参数) 在: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..ctor (System.String name, System.Int32 workerCount, System.Int32 useThreadPoolQueueLength, System.Threading.ThreadPriority priority) [0x00072] 在 C:\Code\Pipelines.Sockets.Unofficial\src \Pipelines.Sockets.Unofficial\DedicatedThreadPoolPipeScheduler.cs:74 在 StackExchange.Redis.SocketManager..ctor(System.String 名称,System.Int32 workerCount,StackExchange.Redis.SocketManager+SocketManagerOptions 选项)[0x0006e] 在 //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 在 //src/StackExchange.Redis/SocketManager.cs:132 中的 StackExchange.Redis.SocketManager.get_Shared () [0x0000c] 在 StackExchange.Redis.ConnectionMultiplexer.OnCreateReaderWriter (StackExchange.Redis.ConfigurationOptions 配置) [0x00000] in //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] in //src/ StackExchange.Redis/ConnectionMultiplexer.cs:957 在 StackExchange.Redis.ConnectionMultiplexer.ConnectImplAsync(System.Object 配置,System.IO.TextWriter 日志)[0x0003a] 在 /_/src/StackExchange.Redis/ConnectionMultiplexer.cs:854 在 C:\Users\tomas.fabian\source\repos\Joker.BlazorApp.Sample\Joker.BlazorApp.Sample\Pages\ProductsComponentBase.cs:52 中的 Joker.BlazorApp.Sample.Pages.ProductsComponentBase.OnInitializedAsync () [0x0007c] 在 Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync () in :0
【问题讨论】:
标签: blazor stackexchange.redis blazor-client-side blazor-webassembly