简体   繁体   中英

Can not use blazor with server-side hosting

Hello i am trying to use Blazor with a server-side hosting .So i set the server as the start-up project.However once i start the server , i cannot access the client from the browser. If i am doing server-side hosting , shouldn't i have to be able to acess the client in the browser ?

PS I still do not understand when doing server-side hosting,does it refer to the separate project or the .net core withing the client project. (I do not understand how the latter is started)

It took me a bit to understand it as well, assuming I do now. With server-side you more or less have a .net core app that serves as a host for another .net core app (the .client app in this case).

Assuming you are starting with the code that is generated via the "server-side" project template, you should be able to start the .Server project and navigate to the url it mentions, or simply set the .Server project as the startup, then hit "Start" in Visual Studio

With the server-side template, you will end up with 2 projects.
(1) "Your-project.App"
This is where you will find your "pages"
(2) "Your-project.Server"
This project "serves" up the .App project. It's also where you can put api controllers etc, or even stand-alone razor pages etc.

You generally won't be accessing the .App code from the .Server project, and unless you are going to use api endpoints, you might not need to add any additional code to the .Server project files.

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM