asp.net-core - 是否可以在 Windows 8.1 上以 Kestrel 模式运行 Blazor 客户端?
问题描述
我正在尝试在我的Windows 8.1机器上运行Blazor Web Assembly 应用程序而没有任何成功。由于Windows 8.1 操作系统不推荐Kestrel模式这一事实,我在我的其他示例项目(在 MVC、Razor Page、Blazor Server 和 API)中使用了这样的硬编码appsettings.js表示法:
"Kestrel": {
"EndpointDefaults": {
"Protocols": "Http1"
}
}
效果很好。但是在Blazor Web Assembly App上没有任何appsettings.js文件。除了appsettings.js,还有一个具有这种默认结构的launcheSettings.json文件:
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:55974",
"sslPort": 44318
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"BlazorClientDemoApp": {
"commandName": "Project",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
当我尝试对上面提到的Kestrel代码进行硬编码时,应用程序不会出现在浏览器上。
是否可以在 Windows 8.1 操作系统上执行此操作。?
规格:
Windows 8.1 64bit
VisualStudio 2019: 16.7.6 version,
SDK 3.1.403 Core,
Microsoft .NET Framework Wersja 4.8.03761,
ASP.NET and Web Tools 2019 16.7.532.,
ASP.NET Core Razor Language Services 16.1.0.,
ASP.NET Web Frameworks and Tools 2019 16.7.532.28833
解决方案
我不确定我是否理解,但您可以使用“wwwroot/appsettings.json”作为常规“appsettings.json”的对应物。当您从“Program.cs”中调用类似的东西时builder.Configuration.GetValue...
,值将从这个 json 文件中获取。
推荐阅读
- r - ColorNumeric 的“无法确定域范围”
- javascript - 在 Typescript 中以编程方式折叠引导导航栏
- android - 调用函数未捕获来自另一个类的 Flutter 错误
- docusignapi - 如何在 DocuSign 中为通过 SDK 创建的所有信封和通知设置语言?
- javascript - .Net Core 单选按钮总是返回 false
- file - 使用 Kotlin 检查文件是否存在于 Android 设备上
- powerapps - 将 powerapps 应用程序共享给多个用户
- python - 如何在不使用 iframe 的情况下结合 Dash 和 Flask 登录?
- javascript - 使用独立代码确定浏览器宽度
- c# - 保持表格可编辑,直到单击保存或取消按钮