要在Blazor Server应用程序中打开Razor视图而不是空白页面,可以按照以下步骤进行操作:
创建一个新的Blazor Server应用程序。可以使用Visual Studio或者命令行工具创建新项目。
打开Pages文件夹,并创建一个新的Razor组件,例如Index.razor。
在Index.razor文件中添加所需的HTML和C#代码,作为Razor视图的内容。例如:
Welcome to My Blazor Server App!
This is my custom Razor view.
@code {
// Add any additional C# code here
}
@using Microsoft.AspNetCore.Components.Web
@(await Html.RenderComponentAsync(RenderMode.ServerPrerendered))
这样,Blazor Server应用程序将使用自定义的Razor视图来替代默认的空白页面。