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

Using Visual studio code #299

Open
eliassal opened this issue Jan 21, 2021 · 10 comments
Open

Using Visual studio code #299

eliassal opened this issue Jan 21, 2021 · 10 comments

Comments

@eliassal
Copy link

This tutorial seems very useful to learn blazor. I use VSC and don't have VS. In chapter 01-components-and-layout, a note indicates
The BlazingPizza.Server project should be set as the startup project.
I am not sure how to do this in VSC, but on command line, I switch to BlazingPizza.Server directory, issue
dotnet run
everything compiles and get Edge fired with the url https://localhost:5001/ (looking at this project properties we have

"applicationUrl": "https://localhost:5001;http://localhost:5000")

I I update BlazingPizza.Client as per tutroial, I get everything correct. When I type in the browser the client URL http://localhost:8080, it does not work.
Can you please indicate how this works and where is the link between client and server? I understand that to access the app we should use the client, NO?
Thanks in advance

@D3KOD3R
Copy link

D3KOD3R commented Jan 25, 2021

change the application url to http://localhost:5000"
the server url to http://localhost:5001"

the server needs to be running preferably before you run the application client up.

client 5000
server 5001

yes you need to use the client to access the application.

once you have changed the application url's to the above.

type in the browser the url for the client.

also set multiple startup and set the server to start up aswell. do this by right clicking on the sln file

Capture

@eliassal
Copy link
Author

Thanks, I will do. However, as I indcated, I use visual studio code, how can I achieve setting multi startup and prioritize them? Thanks again

@eliassal
Copy link
Author

But D3, still I need a response please, how I was accessing the server url and updates I do in client were reflected and worked fine

@eliassal
Copy link
Author

eliassal commented Jan 25, 2021

In the client project, I do dotnet run but it fails, how I can run the client? So the question now is How do I run the client application?
In the launch.json of the root app it is indicated
"type": "edge",
"request": "launch",
"name": "Launch Edge against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}\BlazingPizza.Server"
So should I change this or where I change the url for the client?
Thanks

@eliassal
Copy link
Author

I changed the webRoot value to
"url": "http://localhost:5000",
"webRoot": "${workspaceFolder}\BlazingPizza.Client"
when I hit run in VSC, I get a very strange error
PizzaClient

@D3KOD3R
Copy link

D3KOD3R commented Jan 25, 2021 via email

@eliassal
Copy link
Author

even when I revert bakc to "webRoot": "${workspaceFolder}\BlazingPizza.Server" I get the same error.
Anyway, lest imagine I have VS, how the link between the client and server works, where is the connection done is done.
If I understand how the link works maybe I can find a solution. It is not possible to use DOTNET RUN with the client project

@eliassal
Copy link
Author

As I said, whe I do DOTNET RUN inside the server project from powershell command line, it runs correctly and can access all functions BUT what IS STRANGE is the updates in client are reflected whereas I am accessing the server, so my question again how this can happen, where is the link?

PizzaServer_DotNetRun

PizzaServer_DotNetRun_002

@RonnyRusten
Copy link

Look in the .sln and .csproj-files. I THINK the links are in these files, but they might as well be somewhere else (I actually don't know, but saw some connections there...). I recomend VS 2019 Community Edition if you can't get VS Code to work...

@lohithgn
Copy link

lohithgn commented Apr 15, 2021

This tutorial seems very useful to learn blazor. I use VSC and don't have VS. In chapter 01-components-and-layout, a note indicates
The BlazingPizza.Server project should be set as the startup project.
I am not sure how to do this in VSC, but on command line, I switch to BlazingPizza.Server directory, issue
dotnet run
everything compiles and get Edge fired with the url https://localhost:5001/ (looking at this project properties we have

"applicationUrl": "https://localhost:5001;http://localhost:5000")

I I update BlazingPizza.Client as per tutroial, I get everything correct. When I type in the browser the client URL http://localhost:8080, it does not work.
Can you please indicate how this works and where is the link between client and server? I understand that to access the app we should use the client, NO?
Thanks in advance

Hi. Although the front end is Blazor WebAssembly - it is being served from a Web Server. Blazor WebAssembly can be thought of as a Static Site App. But you need a server to serve the web assets. In this demo we create a ASP.NET MVC Server and we use this server to serve the Blazor Static Site App. Plus the Server is also used to create the APIs required by the Blazor WebAssembly App.

When you navigate to https://localhost:5001 - this serves the client app (i.e. blazor webassembly app). the client app runs in your browser & makes an api call on the same domain. If you look at OrderClient class it is making a request to "orders" endpoint. When the call is made the complete endpoint will be https://localhost:5001/orders ... This is how the demo is working and architected.

Hope this helps.

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

No branches or pull requests

4 participants