The Welcome text app's purpose is to generate a web link to the WelcomeText site and send the link to a new customer. On the site, the customer is supposed to be greeted by a welcome message, but the welcome page never displays and instead goes immediately to an error page
Development Mode Swapping to the Development environment displays detailed information about the error that occurred
The app is being published from Visual Studio to an IIS web server. The last 2 error logs I received when running it were:
An ISAPI reported an unhealthy condition to its worker process. Therefore, the worker process with process id of '924' serving application pool 'WelcomeText' has requested a recycle.
and
Log Name: Application
Source: .NET Runtime
Date: 11/5/2024 3:27:33 PM
Event ID: 1000
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: BLAZOR.hometowne.local
Description:
Category: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware
EventId: 1
SpanId: 23bb04c94decbf4d
TraceId: a03b83ddef80d2323a257ad2617d08b3
ParentId: 0000000000000000
RequestId: 40008782-0006-be00-b63f-84710c7967bb
RequestPath: /welcome/feeeef
ActionId: 6b03fe1e-b4a6-4b60-8b05-a45167a2a608
ActionName: /_HostAn unhandled exception has occurred while executing the request.
Exception: System.InvalidOperationException: The current thread is not associated with the Dispatcher. Use InvokeAsync() to switch execution to the Dispatcher when triggering rendering or component state.
at Microsoft.AspNetCore.Components.ComponentBase.StateHasChanged()
at WelcomeText.Shared.Pinegrow.UpdateProgressBar(MessageArgs args) in \WelcomeText\Shared\Pinegrow.razor:line 67
at BlazorComponentBus.ComponentBus.<>c__DisplayClass12_1`1.b__2()
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
at BlazorComponentBus.ComponentBus.Publish[T](T message, CancellationToken ct)
at WelcomeText.Pages.WelcomePage.OnInitializedAsync() in C:\Users\jkligel\source\repos\hometowne001\HTCApps\WelcomeText\Pages\WelcomePage.razor:line 67
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
at ...
I tried commenting out this line of code:
if (!app.Environment.IsDevelopment()){ app.UseExceptionHandler("/Error"); app.UseHsts();}and I also tried changing the ASPNETCORE_ENVIRONMENT value from "Development" to "Production"
None of the solutions worked.
My web.config says
<?xml version="1.0" encoding="utf-8"?><configuration><location path="." inheritInChildApplications="false"><system.webServer><handlers><add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" /></handlers><aspNetCore processPath="dotnet" arguments=".\WelcomeText.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" /><environmentVariables><environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" /></environmentVariables></system.webServer></location></configuration><!--ProjectGuid: 4a5d8fb7-ed18-42d5-a130-e51889d7df34-->