问题解决的关键是将应用程序的RootURI设置为正确的值。在Blazor客户端应用程序中,可以通过以下方式设置RootURI:
在Blazor服务器应用程序中,可以通过以下方式设置RootURI:
app.UseBlazor(options =>
{
options.Services.AddServerSideBlazor();
options.RootComponents.Register("app");
options.JSInterop.DefaultCallTimeout = TimeSpan.FromSeconds(30);
options.CircuitOptions = new CircuitOptions {
// Set the client to server path in with the root URI
ClientDefaultBaseURI = @"/",
// Set the single user idleness timeout to prevent "lock-out"
// since the server side and client side signals are not connected.
UserMaxIdleness = TimeSpan.FromMinutes(20)
};
});
在这两种情况下,RootURI都应该是应用程序部署的URL。将RootURI设置为正确的值,应该会解决Dev工具显示无限网络循环的问题。