You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/architecture/blazor-for-web-forms-developers/app-startup.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,18 +13,18 @@ Applications that are written for ASP.NET typically have a `global.asax.cs` file
13
13
14
14
## Application_Start and Web Forms
15
15
16
-
The default web forms `Application_Start` method has grown in purpose over years to handle many configuration tasks. A fresh web forms project with the default template in Visual Studio 2022 now contains the following configuration logic:
16
+
The default web forms `Application_Start` method has grown in purpose over years to handle many configuration tasks. A fresh web forms project with the default template in Visual Studio contains the following configuration logic:
17
17
18
18
-`RouteConfig` - Application URL routing
19
19
-`BundleConfig` - CSS and JavaScript bundling and minification
20
20
21
-
Each of these individual files resides in the `App_Start` folder and run only once at the start of our application. `RouteConfig` in the default project template adds the `FriendlyUrlSettings` for web forms to allow application URLs to omit the `.ASPX` file extension. The default template also contains a directive that provides permanent HTTP redirect status codes (HTTP 301) for the `.ASPX` pages to the friendly URL with the file name that omits the extension.
21
+
Each of these individual files resides in the `App_Start` folder and run only once at the start of our application. `RouteConfig` in the default project template adds the `FriendlyUrlSettings` for web forms to allow application URLs to omit the `.ASPX` file extension. The default template also contains a directive that provides permanent HTTP redirect status codes (HTTP 301) for the `.ASPX` pages to the friendly URL with the file name that omits the extension.
22
22
23
23
With ASP.NET Core and Blazor, these methods are either simplified and consolidated into the `Startup` class or they are eliminated in favor of common web technologies.
24
24
25
25
## Blazor Server Startup Structure
26
26
27
-
Blazor Server applications reside on top of an ASP.NET Core 3.0 or later version. ASP.NET Core web applications are configured in *Program.cs*, or through a pair of methods in the `Startup.cs` class. A sample *Program.cs* file is shown below:
27
+
Blazor Server applications reside on top of an ASP.NET Core 3.0 or later version. ASP.NET Core web applications are configured in *Program.cs*, or through a pair of methods in the `Startup.cs` class. A sample *Program.cs* file is shown below:
The app's required services are added to the `WebApplicationBuilder` instance's `Services` collection. This is how the various ASP.NET Core framework services are configured with the framework's built-in dependency injection container. The various `builder.Services.Add*` methods add services that enable features such as authentication, razor pages, MVC controller routing, SignalR, and Blazor Server interactions among many others. This method was not needed in web forms, as the parsing and handling of the ASPX, ASCX, ASHX, and ASMX files were defined by referencing ASP.NET in the web.config configuration file. More information about dependency injection in ASP.NET Core is available in the [online documentation](/aspnet/core/fundamentals/dependency-injection).
60
+
The app's required services are added to the `WebApplicationBuilder` instance's `Services` collection. This is how the various ASP.NET Core framework services are configured with the framework's built-in dependency injection container. The various `builder.Services.Add*` methods add services that enable features such as authentication, razor pages, MVC controller routing, SignalR, and Blazor Server interactions among many others. This method was not needed in web forms, as the parsing and handling of the ASPX, ASCX, ASHX, and ASMX files were defined by referencing ASP.NET in the web.config configuration file. More information about dependency injection in ASP.NET Core is available in the [online documentation](/aspnet/core/fundamentals/dependency-injection).
61
61
62
62
After the `app` has been built by the `builder`, the rest of the calls on `app` configure its HTTP pipeline. With these calls, we declare from top to bottom the [Middleware](middleware.md) that will handle every request sent to our application. Most of these features in the default configuration were scattered across the web forms configuration files and are now in one place for ease of reference.
63
63
64
-
No longer is the configuration of the custom error page placed in a `web.config` file, but now is configured to always be shown if the application environment is not labeled `Development`. Additionally, ASP.NET Core applications are now configured to serve secure pages with TLS by default with the `UseHttpsRedirection` method call.
64
+
No longer is the configuration of the custom error page placed in a `web.config` file, but now is configured to always be shown if the application environment is not labeled `Development`. Additionally, ASP.NET Core applications are now configured to serve secure pages with TLS by default with the `UseHttpsRedirection` method call.
65
65
66
-
Next, an unexpected configuration method call is made to `UseStaticFiles`. In ASP.NET Core, support for requests for static files (like JavaScript, CSS, and image files) must be explicitly enabled, and only files in the app's *wwwroot* folder are publicly addressable by default.
66
+
Next, an unexpected configuration method call is made to `UseStaticFiles`. In ASP.NET Core, support for requests for static files (like JavaScript, CSS, and image files) must be explicitly enabled, and only files in the app's *wwwroot* folder are publicly addressable by default.
67
67
68
-
The next line is the first that replicates one of the configuration options from web forms: `UseRouting`. This method adds the ASP.NET Core router to the pipeline and it can be either configured here or in the individual files that it can consider routing to. More information about routing configuration can be found in the [Routing section](pages-routing-layouts.md).
68
+
The next line is the first that replicates one of the configuration options from web forms: `UseRouting`. This method adds the ASP.NET Core router to the pipeline and it can be either configured here or in the individual files that it can consider routing to. More information about routing configuration can be found in the [Routing section](pages-routing-layouts.md).
69
69
70
-
The final `app.Map*` calls in this section define the endpoints that ASP.NET Core is listening on. These routes are the web accessible locations that you can access on the web server and receive some content handled by .NET and returned to you. The first entry, `MapBlazorHub` configures a SignalR hub for use in providing the real-time and persistent connection to the server where the state and rendering of Blazor components is handled. The `MapFallbackToPage` method call indicates the web-accessible location of the page that starts the Blazor application and also configures the application to handle deep-linking requests from the client-side. You will see this feature at work if you open a browser and navigate directly to Blazor handled route in your application, such as `/counter` in the default project template. The request gets handled by the *_Host.cshtml* fallback page, which then runs the Blazor router and renders the counter page.
70
+
The final `app.Map*` calls in this section define the endpoints that ASP.NET Core is listening on. These routes are the web accessible locations that you can access on the web server and receive some content handled by .NET and returned to you. The first entry, `MapBlazorHub` configures a SignalR hub for use in providing the real-time and persistent connection to the server where the state and rendering of Blazor components is handled. The `MapFallbackToPage` method call indicates the web-accessible location of the page that starts the Blazor application and also configures the application to handle deep-linking requests from the client-side. You will see this feature at work if you open a browser and navigate directly to Blazor handled route in your application, such as `/counter` in the default project template. The request gets handled by the *_Host.cshtml* fallback page, which then runs the Blazor router and renders the counter page.
71
71
72
72
The very last line starts the application, something that wasn't required in web forms (since it relied on IIS to be running).
73
73
74
74
## Upgrading the BundleConfig Process
75
75
76
-
Technologies for bundling assets like CSS stylesheets and JavaScript files have changed significantly, with other technologies providing quickly evolving tools and techniques for managing these resources. To this end, we recommend using a Node command-line tool such as Grunt / Gulp / WebPack to package your static assets.
76
+
Technologies for bundling assets like CSS stylesheets and JavaScript files have changed significantly, with other technologies providing quickly evolving tools and techniques for managing these resources. To this end, we recommend using a Node command-line tool such as Grunt / Gulp / WebPack to package your static assets.
77
77
78
-
The Grunt, Gulp, and WebPack command-line tools and their associated configurations can be added to your application and ASP.NET Core will quietly ignore those files during the application build process. You can add a call to run their tasks by adding a `Target` inside your project file with syntax similar to the following that would trigger a gulp script and the `min` target inside that script:
78
+
The Grunt, Gulp, and WebPack command-line tools and their associated configurations can be added to your application and ASP.NET Core will quietly ignore those files during the application build process. You can add a call to run their tasks by adding a `Target` inside your project file with syntax similar to the following that would trigger a gulp script and the `min` target inside that script:
Copy file name to clipboardExpand all lines: docs/architecture/microservices/docker-application-development-process/docker-app-development-workflow.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ In this section, this whole process is detailed and every major step is explaine
32
32
33
33
When you're using an editor/CLI development approach (for example, Visual Studio Code plus Docker CLI on macOS or Windows), you need to know every step, generally in more detail than if you're using Visual Studio. For more information about working in a CLI environment, see the e-book [Containerized Docker Application lifecycle with Microsoft Platforms and Tools](https://aka.ms/dockerlifecycleebook/).
34
34
35
-
When you're using Visual Studio 2022, many of those steps are handled for you, which dramatically improves your productivity. This is especially true when you're using Visual Studio 2022 and targeting multi-container applications. For instance, with just one mouse click, Visual Studio adds the `Dockerfile` and `docker-compose.yml` file to your projects with the configuration for your application. When you run the application in Visual Studio, it builds the Docker image and runs the multi-container application directly in Docker; it even allows you to debug several containers at once. These features will boost your development speed.
35
+
When you're using Visual Studio 2022 or later, many of those steps are handled for you, which dramatically improves your productivity. This is especially true when you're targeting multi-container applications. For instance, with just one mouse click, Visual Studio adds the `Dockerfile` and `docker-compose.yml` file to your projects with the configuration for your application. When you run the application in Visual Studio, it builds the Docker image and runs the multi-container application directly in Docker; it even allows you to debug several containers at once. These features will boost your development speed.
36
36
37
37
However, just because Visual Studio makes those steps automatic doesn't mean that you don't need to know what's going on underneath with Docker. Therefore, the following guidance details every step.
38
38
@@ -48,7 +48,7 @@ To begin, make sure you have [Docker Desktop for Windows](https://docs.docker.co
48
48
49
49
[Get started with Docker Desktop for Windows](https://docs.docker.com/docker-for-windows/)
50
50
51
-
In addition, you need Visual Studio 2022 version 17.0, with the **.ASP.NET and web development** workload installed, as shown in Figure 5-2.
51
+
In addition, you need Visual Studio 2022 or later with the **.ASP.NET and web development** workload installed, as shown in Figure 5-2.
52
52
53
53

54
54
@@ -61,7 +61,7 @@ You can start coding your application in plain .NET (usually in .NET Core or lat

@@ -72,7 +72,7 @@ You need a Dockerfile for each custom image you want to build; you also need a D
72
72
73
73
The Dockerfile is placed in the root folder of your application or service. It contains the commands that tell Docker how to set up and run your application or service in a container. You can manually create a Dockerfile in code and add it to your project along with your .NET dependencies.
74
74
75
-
With Visual Studio and its tools for Docker, this task requires only a few mouse clicks. When you create a new project in Visual Studio 2022, there's an option named **Enable Docker Support**, as shown in Figure 5-3.
75
+
With Visual Studio and its tools for Docker, this task requires only a few mouse clicks. When you create a new project in Visual Studio, there's an option named **Enable Docker Support**, as shown in Figure 5-3.
76
76
77
77

78
78
@@ -404,7 +404,7 @@ The docker-compose.yml file specifies not only what containers are being used, b
404
404
405
405
We will revisit the docker-compose.yml file in a later section when we cover how to implement microservices and multi-container apps.
406
406
407
-
### Working with docker-compose.yml in Visual Studio 2022
407
+
### Working with docker-compose.yml in Visual Studio
408
408
409
409
Besides adding a Dockerfile to a project, as we mentioned before, Visual Studio 2017 (from version 15.8 on) can add orchestrator support for Docker Compose to a solution.
410
410
@@ -519,9 +519,9 @@ You can also test the application using curl from the terminal, as shown in Figu
519
519
520
520
**Figure 5-14**. Example of testing your Docker application locally using curl
521
521
522
-
### Testing and debugging containers with Visual Studio 2022
522
+
### Testing and debugging containers with Visual Studio
523
523
524
-
When running and debugging the containers with Visual Studio 2022, you can debug the .NET application in much the same way as you would when running without containers.
524
+
When running and debugging the containers with Visual Studio, you can debug the .NET application in much the same way as you would when running without containers.
Copy file name to clipboardExpand all lines: docs/architecture/microservices/docker-application-development-process/index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ ms.date: 11/19/2021
15
15
16
16
Whether you prefer a full and powerful IDE or a lightweight and agile editor, Microsoft has tools that you can use for developing Docker applications.
17
17
18
-
**Visual Studio (for Windows).** Docker-based .NET 8 application development with Visual Studio requires Visual Studio 2022 version 17.0 or later. Visual Studio 2022 comes with tools for Docker already built in. The tools for Docker let you develop, run, and validate your applications directly in the target Docker environment. You can press <kbd>F5</kbd> to run and debug your application (single container or multiple containers) directly into a Docker host, or press <kbd>CTRL</kbd> + <kbd>F5</kbd> to edit and refresh your application without having to rebuild the container. This IDE is the most powerful development choice for Docker-based apps.
18
+
**Visual Studio (for Windows).** Docker-based .NET 8 application development with Visual Studio requires Visual Studio 2022 or later. Visual Studio comes with tools for Docker already built in. The tools for Docker let you develop, run, and validate your applications directly in the target Docker environment. You can press <kbd>F5</kbd> to run and debug your application (single container or multiple containers) directly into a Docker host, or press <kbd>CTRL</kbd> + <kbd>F5</kbd> to edit and refresh your application without having to rebuild the container. This IDE is the most powerful development choice for Docker-based apps.
19
19
20
20
**Visual Studio Code and Docker CLI**. If you prefer a lightweight and cross-platform editor that supports any development language, you can use Visual Studio Code and the Docker CLI. This IDE is a cross-platform development approach for macOS, Linux, and Windows. Additionally, Visual Studio Code supports extensions for Docker such as IntelliSense for Dockerfiles and shortcut tasks to run Docker commands from the editor.
0 commit comments