更新:
在 Github ASP.NET Core 项目上创建了一个问题:
https://github.com/dotnet/aspnetcore/issues/32522
原来的:
使用 Microsoft Visual Studio 2019 版本 16.9.4 和 Target Framework .NET 5.0 和 ASP.NET Core Hosted 创建了一个新的 Blazor WebAssembly 应用程序。
问题是,如果我在将站点发布到 Azure Web 应用程序时从浏览器进行 API 调用,我会收到如下错误响应:
抱歉,此地址没有任何内容。
如果我使用“空缓存和硬重新加载”发出请求,一切都会按预期进行。
该请求始终适用于localhost。
它不仅限于通过 API 加载的图像,对于JSON response.
如何判断Blazor不使用/忽略包含 的 URL 的路由/api/?
我已经读过ASP.NET Core Blazor routing但没有在那里找到任何东西。
https://docs.microsoft.com/en-us/aspnet/core/blazor/fundamentals/routing?view=aspnetcore-5.0
错误消息来自App.razor文件:
<CascadingAuthenticationState>
<Router AppAssembly="@typeof(Program).Assembly" PreferExactMatches="@true">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
</Found>
<NotFound>
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing …Run Code Online (Sandbox Code Playgroud)