I tried this tutorial and confirmed that it works fine in Visual Studio debugging. However, when I deploy to IIS, I get a 500 Internal Server Error as shown below. It looks like I can’t access the protected API.
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: net_http_message_not_success_statuscode, 500, Internal Server Error
System.Net.Http.HttpRequestException: net_http_message_not_success_statuscode, 500, Internal Server Error
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at System.Net.Http.Json.HttpClientJsonExtensions.<GetFromJsonAsyncCore>d__13`1[[System.Collections.Generic.List`1[[QuizManagerClientHosted.Shared.QuizItem, QuizManagerClientHosted.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
at QuizManagerClientHosted.Client.Pages.QuizViewer.OnInitializedAsync()
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task , ComponentState )
The IIS website is configured with ‘https://localhost:8081’, and the Auth0 application’s ‘Allowed Callback Urls’ and ‘Allowes Logout Urls’ are set.
I can log in and log out, but when I clicked “Quiz” on the menu, an error occured and the message “Loading” remained displayed.
Environment:
Windows 10 21H2
.NET 6
Visual Studio 2022 Ver. 17.7.5