Blazor server app that I need to convert to wasm

Jim Cheseborough 1 Reputation point
2022-12-21T09:30:18.007+00:00

How can I most easily find a “mentor” or “second set of eyes” to help me get over a Blazor wasm project install? I have a working Blazor server app that I need to convert to wasm, and it’s different enough that’s it a real PITA getting the answers I need.

Been looking on the net a LOT and can't find what I need.
First off, how to I deploy to a "regular" host?
What folders do I make.
One for /wasm /server /api ?

Please view a YouTube video I made explaining the whole problem!
https://youtu.be/PetZPduNc-c

Thanks a lot!

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,386 questions
{count} votes

5 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 55,686 Reputation points
    2022-12-23T20:37:52.347+00:00

    It appears the blazor wasm publish is not happening. I'd publish to file folder and check the results. The blazor wasm publish should have added the blazor files to the wwwroot folder.

    did you create the projects as explained above (with the core hosted option)? this is important because it adds the blazor wasm publish step to the server publish in the project files.

    you can also try running, the blazor wasm publish. it should be a file deploy to the server bin wwwroot folder. then run the server publish.

    1 person found this answer helpful.
    0 comments No comments

  2. Bruce (SqlWork.com) 55,686 Reputation points
    2022-12-21T16:50:29.363+00:00

    we need more info.

    a standalone blazor WASM is just a static site. any web server can host.

    you can also combine a blazor WASM project and webapi project. In this case the webapi project uses the static file handler to host the blazor static site.

    you can have a static blazor WASM project, a separate webapi project that uses CORS.

    your best bet is to create a new blazor WASM project of the type you want, then copy your blazor app code to it.


  3. Jim Cheseborough 1 Reputation point
    2022-12-22T05:08:26.597+00:00

    Maybe I should make a YouTube video of what I did.
    I created the “skeleton” wasm app and published it.

    That’s all I did.
    It runs locally before the publish, but the publish results in that error. What other info can I give to help you help me? I REALLY NEED TO SOLVE THIS!! Thx

    0 comments No comments

  4. Jim Cheseborough 1 Reputation point
    2022-12-26T10:07:02.657+00:00

    Thanks a lot for reaching out!
    I did more digging and founds this gem from YOU!! (seems to solve it!):
    [https://learn.microsoft.com/en-us/answers/questions/902965/error-in-deploying-core-hosted-blazor-wasm.html]

    Bruce-SqlWork answered • Jun 24 2022 at 1:02 PM BEST ANSWERACCEPTED ANSWER
    the blazor client project is setup to run as a root site. (https://servername)

    you are probably hosting as a subset (https://servername/mysite). in index.html you need to update:

    <base href="/" />

    to be your subsite:

    <base href="/mysite/" />

    note: unlike react spa, the index.html file is not generated at publish, so its hand edited. you can use a sed script to edit, or as MS suggests, run locally as a subsite with the same name:

    https://learn.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/webassembly?view=aspnetcore-6.0


  5. Rijwan Ansari 746 Reputation points MVP
    2023-01-11T13:21:46.5833333+00:00
    0 comments No comments