Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the full-stack website of Asp.net Core3 and Blazor

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

How to use Asp.net Core3 and Blazor full-stack websites, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

The latest Microsoft video: Full stack web development with ASP.NET Core 3.0 and Blazor-BRK3017

The following are important steps to take screenshots and annotations:

1. Full-stack solution architecture

A schematic diagram of the full stack solution for .net Core3.

The first part of the diagram, Client, is flexible to replace, even if it is Vue,Angular or JQuery is a perfect solution. At the beginning of the pursuit of an overall front-end solution, it was the era of plug-ins, the era of IFrame. The reason why there is no unified framework may be that there is not a unified Router, and Router is the adhesive of the frame. Things like ExtJs,Hae were the peak products at that time, implementing simulation classes, component inheritance, routing, page lifecycle management, and so on. In these beautiful times, with Vue,Angular, the project framework is done with a command line, and now Blazor (Client-side) is the first front-end solution to be implemented using WebAssembly!

In the process of website development and evolution, the pre-and post-separation mode is basically recommended as the mainstream, but the integrated technical architecture appears from time to time, which I call the full-stack solution. For example, the previous Asp.net and MEAN frameworks. Asp.net framework implements WebForm architecture through heavy ViewState to achieve state transmission, and finally can not stand the gentle click of MVC to give way; while MEAN framework is thinking ahead, full-stack development with JS, using JSON to transfer data, but it is too minority; there are some technologies such as Gwt or Abp, the slogan is that the front end directly calls the back-end service or function. Then this time Blazor (Server-side) is the second time that Microsoft has explored the integrated technical architecture, and it is the first full-stack solution using WebSocket technology!

In the second part, the majority of Javaer please skip it manually, and Neter can believe in recharging again. When it comes to .Net Core3.0, the Controller of Mvc and Web Api are perfectly unified, the view syntax of MVC and Razor pages is the same, and Razor Pages can intervene flexibly without many conventions of MVC (the regeneration of asp).

). The extremely simple use of SignalR, supporting Web, .net, and Java client connections as well as the future C++ client, its background development you can use Web services to host, and even can be controlled by the console or desktop programs. Speaking of desktop programs can control each Client, let me think of the development of online games, perhaps SignalR can support the background management of online games, boldly imagine that in the future, the network connection modules of online games are all written in SignalR, while the other focus of the game is only graphics and logic modules (that is, the Client development of the game). I have no contact with game development, do not know how the existing game engine networking modules work and efficient, but I think SignalR is a gift from Microsoft to developers all over the world, no matter what language he uses and what field he is in, you can give it a try.

In the third part, the arrival of gRPC is a revolution, although it extends the front of the back end by another kilometer, but this kilometer is worth it. Imagine that in the future, the majority of Net, Java, Python programmers can sit down and caress the keyboard. And Work Services is a service function brought by .net Core3, which is an ongoing process.

I don't know if careful people have found that there is no EF Core (data layer) without the above picture. In fact, the location of EF Core is in Web Api, Worker services, and gRPC, and its status is just a gadget.

Second, how to start Blazor project debugging

Here are the startup steps for a debuggable and secure Blazor!

III. The basic use of Blazor and the introduction of a third-party Blazor component library

Briefly mentioned the Blazor route @ page, the page is the component, the Razor file and Razor syntax, how to initiate the Http request to the background, and then

Demonstrated the third-party table components and the front end to download Excel files

How to export Excel files

Exporting files on the browser side is originally a weakness, but how to save files here is really realized by Net Core?

An important partner

IV. Two modes of Blazor and their advantages and disadvantages

Client-side: the front end has a large load, depends on the browser's wasm capability, and has a fast response. And Microsoft tagged Future.

Server-side: the front-end load is small, the SignalR is heavy, the back-end load is heavy, and the page elements are also transmitted in real time. It was officially released with 3.0.

I think this model is once again forcibly built by Microsoft, strong is good, straight can bend, curved can be straight, but it is really a mystery whether it can be promoted or not. This is Microsoft's car-building plan again, referring to the asp.net platform (other companies only have the ability to build wheels, Microsoft has always built cars)

The server mode initially loaded very little, 400k, and the browser completely became a puppet. The components of View, Razor Pages, and Blazor in the mvc framework are all Rendering Model, which are sent to the browser with the request, while the State of the component is placed on the server side. It is recommended to listen to it several times in 32-33 minutes!

Today's Blazor Server projects, browsers and backends are like a whole stand-alone program, such as wpf,winform development, the components are stateful, but you don't have to care about it. This is another pursuit of integration after the failure of Microsoft's ViewState solution for asp.net WebForm architecture. I don't understand why Microsoft has recognized such a thing as state. Is the stateless HTTP uncomfortable now?

5. SPA templates supported by Asp.net Core3

Angular7 & asp.net core3 perfect fit

6. Worker Services, a project template for a service process

In .net Core3.0, there is a new Worker Services template, which is a long-running worker process that can be hosted in windows services, systemd,WebJobs, container

Aps.net core's easy-to-use configuration items, logs and DI are all built-in, all you have to do is create a new asp.net core project and choose the Work Services template!

This is a minimalist framework, Microsoft Dafa is better!

Add service support for windows, and it can be easily deployed as service. Here are the steps!

Add one more sentence, and then release the project.

Just start the service:

An example of a pizza order

Settings for starting multiple projects at a time:

7. GRPC

The proto file is compiled automatically.

VIII. Better analysis tools and performance

IX. New features and release schedule

After reading the above, do you know how to use the full-stack websites of Asp.net Core3 and Blazor? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report