Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor server app not working on one computer but working on others

$
0
0

I have a Blazor server app that I develop. In this there is a scoped css for a component and 2 components from a nuget package.

When I run this on my virtual developer machine with Visual Studio 2022 (17.10.0) it does not work. I get this in the dev-tools console:

:44313/_content/DevExpress.Blazor.RichEdit/dx-blazor-richedit.bs5.css:1        Failed to load resource: the server responded with a status of 404 ():44313/_content/DevExpress.Blazor.Themes/blazing-berry.bs5.min.css:1        Failed to load resource: the server responded with a status of 404 ():44313/MyComponent.styles.css:1        Failed to load resource: the server responded with a status of 404 ()blazor.server.js:1 [2024-05-28T06:40:43.580Z] Information: Normalizing '_blazor' to 'https://localhost:44313/_blazor'.blazor.server.js:1 [2024-05-28T06:40:43.847Z] Information: WebSocket connected to wss://localhost:44313/_blazor?id=sD_elkEuLZmwWvGAeWYbbw.:44313/_content/DevExpress.Blazor/modules/dx-blazor-95ab6d2f.js:1        Failed to load resource: the server responded with a status of 404 ():44313/_content/DevExpress.Blazor/modules/dx-form-layout-d94d1af4.js:1        Failed to load resource: the server responded with a status of 404 ()blazor.server.js:1 [2024-05-28T06:40:45.559Z] Error: System.NullReferenceException: Object reference not set to an instance of an object.   at DevExpress.Blazor.Popup.Internal.PopupRendererModelBase.ClientSideShowAsync(CancellationToken token)   at DevExpress.Blazor.Popup.Internal.PopupBaseModel.<>c__DisplayClass59_0.<<ShowAsync>g__ShowAsyncCore|0>d.MoveNext()--- End of stack trace from previous location ---   at DevExpress.Blazor.Popup.Internal.TaskExtensions.LogCancel[T](Task`1 task, CancellationToken token, ILogger logger, String message)   at DevExpress.Blazor.Popup.Internal.PopupBaseModel.ShowAsync(CancellationToken token)   at DevExpress.Blazor.Popup.Internal.AsyncTask.InvokeAsync()   at DevExpress.Blazor.Popup.Internal.PopupBaseModel.VisibleChangedAsync()   at DevExpress.Blazor.Popup.Internal.PopupBaseModel.AfterRenderAsync(Boolean firstRender)   at DevExpress.Blazor.Popup.Internal.TaskExtensions.WaitOrCancel(Task task, CancellationToken token)   at DevExpress.Blazor.DxPopupBase.<>c__DisplayClass230_0.<<OnAfterRenderAsync>g__AfterRenderLocalAsync|0>d.MoveNext()--- End of stack trace from previous location ---   at DevExpress.Blazor.Popup.Internal.TaskExtensions.SafeInvokeAsync(Task task, CancellationTokenSource tcs)   at DevExpress.Blazor.DxPopupBase.OnAfterRenderAsync(Boolean firstRender)   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)log @ blazor.server.js:1blazor.server.js:1 [2024-05-28T06:40:45.560Z] Information: Connection disconnected.MyComponent.styles.css:1        Failed to load resource: the server responded with a status of 404 ()dx-blazor-richedit.bs5.css:1        Failed to load resource: the server responded with a status of 404 ()blazing-berry.bs5.min.css:1        Failed to load resource: the server responded with a status of 404 ()

I have enabled "Trace" level logs and in the output window I get:

Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request starting HTTP/2 GET https://localhost:44313/MyComponent.styles.css - - -Microsoft.AspNetCore.HostFiltering.HostFilteringMiddleware: Trace: All hosts are allowed.Microsoft.AspNetCore.HttpsPolicy.HstsMiddleware: Debug: The host 'localhost' is excluded. Skipping HSTS header.Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request starting HTTP/2 GET https://localhost:44313/_content/DevExpress.Blazor.RichEdit/dx-blazor-richedit.bs5.css - - -Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware: Debug: The request path /MyComponent.styles.css does not match an existing fileMicrosoft.AspNetCore.HostFiltering.HostFilteringMiddleware: Trace: All hosts are allowed.Microsoft.AspNetCore.Routing.Matching.DfaMatcher: Debug: 1 candidate(s) found for the request path '/MyComponent.styles.css'Microsoft.AspNetCore.HttpsPolicy.HstsMiddleware: Debug: The host 'localhost' is excluded. Skipping HSTS header.Microsoft.AspNetCore.Routing.Matching.DfaMatcher: Debug: Endpoint 'Fallback {*path:nonfile}' with route pattern '{*path:nonfile}' was rejected by constraint 'path':'Microsoft.AspNetCore.Routing.Constraints.NonFileNameRouteConstraint' with value 'MyComponent.styles.css' for the request path '/MyComponent.styles.css'Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware: Debug: The request path /_content/DevExpress.Blazor.RichEdit/dx-blazor-richedit.bs5.css does not match an existing fileMicrosoft.AspNetCore.Routing.Matching.DfaMatcher: Debug: Endpoint 'Fallback {*path:nonfile}' with route pattern '{*path:nonfile}' is not valid for the request path '/MyComponent.styles.css'Microsoft.AspNetCore.Routing.Matching.DfaMatcher: Debug: 1 candidate(s) found for the request path '/_content/DevExpress.Blazor.RichEdit/dx-blazor-richedit.bs5.css'Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware: Debug: Request did not match any endpointsMicrosoft.AspNetCore.Routing.Matching.DfaMatcher: Debug: Endpoint 'Fallback {*path:nonfile}' with route pattern '{*path:nonfile}' was rejected by constraint 'path':'Microsoft.AspNetCore.Routing.Constraints.NonFileNameRouteConstraint' with value '_content/DevExpress.Blazor.RichEdit/dx-blazor-richedit.bs5.css' for the request path '/_content/DevExpress.Blazor.RichEdit/dx-blazor-richedit.bs5.css'Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request starting HTTP/2 GET https://localhost:44313/_content/DevExpress.Blazor.Themes/blazing-berry.bs5.min.css - - -Microsoft.AspNetCore.Routing.Matching.DfaMatcher: Debug: Endpoint 'Fallback {*path:nonfile}' with route pattern '{*path:nonfile}' is not valid for the request path '/_content/DevExpress.Blazor.RichEdit/dx-blazor-richedit.bs5.css'Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer: Debug: Connection ID "18230571306091282445" disconnecting.Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware: Debug: Request did not match any endpointsMicrosoft.AspNetCore.Hosting.Diagnostics: Information: Request finished HTTP/2 GET https://localhost:44313/MyComponent.styles.css - 404 - - 83.5307msMicrosoft.AspNetCore.HostFiltering.HostFilteringMiddleware: Trace: All hosts are allowed.

The thing is that on my "local" computer this does not happen. Also it does not happen on my coworkers computers.

The project has .NET 8.0 as target framework.

I get the same result when I:

  • run as "stand-alone" blazor app
  • hosted in ISS Express
  • disregard Visual Studio and run in a cmd-prompt with help of "dotnet run" command

The same problem happens in all the browsers I have tested.

I have uninstalled all .NET 8.* from the computer including the Visual Studio ASP.NET 8.0 components and reinstalled them. Same problem.

For each step I have remove bin/obj folders and rebuild everything.

What can I do to correct this error? Has anyone else come across it?

I rather not do a "reinstall everything from scratch".

----edit

I have created a server blazor app with template "Blazor Web App". .NET 8.0, Server, per page/Component, "Configure for HTTPS" and I get same error:

Failed to load resource: the server responded with a status of 404 ()BlazorApp1.styles.css:1Failed to load resource: the server responded with a status of 404 ()

and the page looks weird because no css.The output for log level "trace":

info: Microsoft.AspNetCore.Hosting.Diagnostics[1]Request starting HTTP/2 GET localhost:7067/… - - -trce: Microsoft.AspNetCore.HostFiltering.HostFilteringMiddleware[2]All hosts are allowed.dbug: Microsoft.AspNetCore.Routing.Matching.DfaMatcher[1000]No candidates found for the request path '/BlazorApp1.styles.css'dbug: Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware[2]Request did not match any endpointsdbug: Microsoft.AspNetCore.HttpsPolicy.HstsMiddleware[2]The host 'localhost' is excluded. Skipping HSTS header.dbug: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[5]The request path /BlazorApp1.styles.css does not match an existing fileinfo: Microsoft.AspNetCore.Hosting.Diagnostics[2]Request finished HTTP/2 GET localhost:7067/… - 404 0 - 34.6410mstrce: Microsoft.AspNetCore.Server.Kestrel.Http2[49]Connection id "0HN3UVCI8T023" sending HEADERS frame for stream ID 11 with length 37 and flags END_STREAM, END_HEADERS.info: Microsoft.AspNetCore.Hosting.Diagnostics[16]Request reached the end of the middleware pipeline without being handled by application code. Request path: GET localhost:7067/…, Response status code: 404

Thank you


Viewing all articles
Browse latest Browse all 4839

Trending Articles