Sim*_*mon 11 asp.net asp.net-web-api blazor blazor-client-side blazor-webassembly
我今天通过以下命令行安装了 Blazor WebAssembly 示例项目 (WeatherForecast):
dotnet new blazorwasm --hosted -o ProjectName
Run Code Online (Sandbox Code Playgroud)
我在调试模式下通过 Visual Studio 2019 安装后直接启动了 SPA。浏览器是:Chrome。浏览器显示应用程序,但是当我选择导航菜单“获取数据”时,什么也没有发生。Chrome 显示 1 个错误:
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: The provided ContentType is not supported; the supported types are 'application/json' and the structured syntax suffix 'application/+json'.
System.NotSupportedException: The provided ContentType is not supported; the supported types are 'application/json' and the structured syntax suffix 'application/+json'.
at System.Net.Http.Json.HttpContentJsonExtensions.ValidateContent (System.Net.Http.HttpContent content) <0x2e87f38 + 0x0009a> in <filename unknown>:0
at System.Net.Http.Json.HttpContentJsonExtensions.ReadFromJsonAsync[T] (System.Net.Http.HttpContent content, System.Text.Json.JsonSerializerOptions options, System.Threading.CancellationToken cancellationToken) <0x2e87d30 + 0x00006> in <filename unknown>:0
at System.Net.Http.Json.HttpClientJsonExtensions.GetFromJsonAsyncCore[T] (System.Threading.Tasks.Task`1[TResult] taskResponse, System.Text.Json.JsonSerializerOptions options, System.Threading.CancellationToken cancellationToken) <0x2e40838 + 0x0011c> in <filename unknown>:0
at BlazorIssue.Client.Pages.FetchData.OnInitializedAsync () [0x00033] in D:\Projects\BlazorIssue\Client\Pages\FetchData.razor:43
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync () <0x2b8cb98 + 0x0013a> in <filename unknown>:0
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask (System.Threading.Tasks.Task taskToHandle) <0x2dd8340 + 0x000b6> in <filename unknown>:0
Run Code Online (Sandbox Code Playgroud)
Chrome 显示以下请求标头:
上下文信息:
这很奇怪,因为这个示例项目的全新安装昨天没有问题。
| 归档时间: |
|
| 查看次数: |
6838 次 |
| 最近记录: |