Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blazor not showed as an option #95651

Closed
indcoder opened this issue Jul 12, 2022 · 3 comments
Closed

Blazor not showed as an option #95651

indcoder opened this issue Jul 12, 2022 · 3 comments

Comments

@indcoder
Copy link

In the introduction to Azure SWA , we have sample code for 5 options including No framework, 3 Javascript frameworks and Blazor.

image

But in this page API which follows the above creation, we see only No framework and the 3 JS frameworks. But, Blazor is strangely missing.

image

IMO, since the creation of Blazor SWA and API are part of the same Azure SWA documentation, it should be standardized and consistent in terms of frameworks and their code samples.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@Grace-MacJones-MSFT
Copy link
Contributor

Hi @indcoder, thanks for bringing this to our attention. I have assigned the issue to the content author to evaluate and update this doc as appropriate

@andrew-gaston
Copy link

andrew-gaston commented Dec 20, 2022

I ran into this issue as well. Running the following command when in the base Blazor WASM project directory and browsing to the application running at http://localhost:4280 displays a 404 page, which makes sense.

swa start . --api-location api

We're serving content out of Client\wwwroot, so I changed it to the following:

swa start .\Client\wwwroot --api-location api

Doing this loaded the index.html file, but _framework/blazor.webassembly.js 404's. This is because the WASM project isn't actually running at this point. My solution was to open a second terminal in VS Code, run the client project using dotnet run and then start the API in the original terminal using this command:

swa start --api-location api

The above command still ran something on http://localhost:4280, but I ignored it and navigated to https://localhost:7192 since that's the port that the client was actually running on.

I then ran into the issue of the HttpClient's BaseAddress pointing to the WASM client's base address, not the API's base address which is different because it's running on a different port, so I had to find a workaround for that.

I partially followed this guide https://www.dotnetcurry.com/aspnet-core/deploy-blazor-webassembly-azure-static-web-apps
I say partially because I had been following the documentation @indcoder linked using VS Code up until this point and wanted to continue with that.

Particularly the section about creating an appsettings.Development.json file under Client\wwwroot and configuring the base address for the functions API running locally on http://localhost:7071.

After getting the result I was looking for locally, I continued with the guide from this point https://learn.microsoft.com/en-us/azure/static-web-apps/add-api?tabs=vue#add-api-location-to-workflow and had no issues with the actual production site once it published through Github Actions.

Repo: https://github.com/andrew-gaston/my-first-static-web-app
Site: https://icy-ocean-0eef5b50f.2.azurestaticapps.net/

Sorry for the lengthy write-up, I hope it all made sense. I was determined to both make it work locally and document it. There's probably a better way than how I did it because it took me far too long to get it going.

@craigshoemaker
Copy link
Contributor

Thanks for providing feedback that helps improve our documentation. This issue has been resolved and we are closing the issue. #please-close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants