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
You will now include additional code for the purpose of demonstrating computation intense work. Go to the `NetAspire.Arm.ApiService` project, and create a new file `ComputationService.cs`. Add the code shown below to this file:
This code defines a static class, ComputationService, designed to perform computationally intensive tasks, specifically matrix multiplication. It contains a public method, PerformIntensiveCalculations, which generates two matrices of a specified size, multiplies them, and stores the resulting matrix.
44
+
45
+
The private method GenerateMatrix creates a one-dimensional array representing a matrix of the given size (matrixSize x matrixSize). Each element in the matrix is initialized with a random double value generated using Random.Shared.NextDouble().
46
+
47
+
The public method PerformIntensiveCalculations multiplies two matrices (matrix1 and matrix2) element by element using nested loops and LINQ. It iterates through each row of the first matrix and each column of the second matrix, calculating the dot product for each element in the resulting matrix. The result of the multiplication is stored in a flattened one-dimensional array, matrixResult.
48
+
49
+
This code is provided for demonstrating heavy computational operations, such as large matrix manipulations, and can simulate workloads in scenarios that mimic intensive data processing or scientific calculations.
50
+
51
+
Then, open the `Program.cs` file in the `NetAspire.Arm.ApiService` directory and add modify the `MapGet` function of the app as shown:
This will trigger matrix multiplications when you click Weather in the web frontend application.
71
+
72
+
To test the code, re-run the application using the following command:
73
+
74
+
```console
75
+
dotnet run --project NetAspire.Arm.AppHost
76
+
```
77
+
78
+
Next, navigate to the web frontend, click Weather, and then return to the dashboard. Click Traces to observe that the operation now takes significantly longer to complete—approximately 4 seconds in the example below:
79
+
80
+

81
+
82
+
You are now ready to deploy the application to the cloud.
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/net-aspire/project.md
-116Lines changed: 0 additions & 116 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,119 +59,3 @@ The architecture is also tailored to improve the development experience. Develop
59
59
60
60
This thoughtfully crafted architecture embodies microservices best practices, promoting scalability, maintainability, and service isolation. It not only simplifies deployment and monitoring but also fosters developer productivity by streamlining workflows and providing intuitive tools for building modern, distributed applications.
61
61
62
-
## Run the Project
63
-
The application will issue a certificate. Before you run the application, add support to trust the HTTPS development certificate by running:
Application host directory is: /Users/db/Repos/NetAspire.Arm/NetAspire.Arm.AppHost
84
-
info: Aspire.Hosting.DistributedApplication[0]
85
-
Now listening on: https://localhost:17222
86
-
info: Aspire.Hosting.DistributedApplication[0]
87
-
Login to the dashboard at https://localhost:17222/login?t=81f99566c9ec462e66f5eab5aa9307b0
88
-
```
89
-
90
-
Click on the link generated for the dashboard. In this case it is: https://localhost:17222/login?t=81f99566c9ec462e66f5eab5aa9307b0. This will direct you to the application dashboard, as shown below:
91
-
92
-

93
-
94
-
On the dashboard, locate and click the endpoint link for `NetAspire.Arm.Web`. This will take you to the Blazor based web application. In the Blazor app, navigate to the Weather section to access and display data retrieved from the WeatherForecast API:
95
-
96
-

97
-
98
-
Return to the dashboard and select the Traces option. This section provides detailed telemetry tracing, allowing you to view the flow of requests, track service dependencies, and analyze performance metrics for your application:
99
-
100
-

101
-
102
-
By following these steps, you will explore the key components of the .NET Aspire application, including its dashboard, data interaction through APIs, and telemetry tracing capabilities.
103
-
104
-
## Modify the Project
105
-
You will now include additional code for the purpose of demonstrating computation intense work. Go to the `NetAspire.Arm.ApiService` project, and create a new file `ComputationService.cs`. Add the code shown below to this file:
This code defines a static class, ComputationService, designed to perform computationally intensive tasks, specifically matrix multiplication. It contains a public method, PerformIntensiveCalculations, which generates two matrices of a specified size, multiplies them, and stores the resulting matrix.
139
-
140
-
The private method GenerateMatrix creates a one-dimensional array representing a matrix of the given size (matrixSize x matrixSize). Each element in the matrix is initialized with a random double value generated using Random.Shared.NextDouble().
141
-
142
-
The public method PerformIntensiveCalculations multiplies two matrices (matrix1 and matrix2) element by element using nested loops and LINQ. It iterates through each row of the first matrix and each column of the second matrix, calculating the dot product for each element in the resulting matrix. The result of the multiplication is stored in a flattened one-dimensional array, matrixResult.
143
-
144
-
This code is provided for demonstrating heavy computational operations, such as large matrix manipulations, and can simulate workloads in scenarios that mimic intensive data processing or scientific calculations.
145
-
146
-
Then, open the `Program.cs` file in the `NetAspire.Arm.ApiService` directory and add modify the `MapGet` function of the app as shown:
This will trigger matrix multiplications when you click Weather in the web frontend application.
166
-
167
-
To test the code, re-run the application using the following command:
168
-
169
-
```console
170
-
dotnet run --project NetAspire.Arm.AppHost
171
-
```
172
-
173
-
Next, navigate to the web frontend, click Weather, and then return to the dashboard. Click Traces to observe that the operation now takes significantly longer to complete—approximately 4 seconds in the example below:
174
-
175
-

176
-
177
-
You are now ready to deploy the application to the cloud.
The application will issue a certificate. Before you run the application, add support to trust the HTTPS development certificate by running:
10
11
@@ -46,78 +47,3 @@ Return to the dashboard and select the Traces option. This section provides deta
46
47

47
48
48
49
By following these steps, you will explore the key components of the .NET Aspire application, including its dashboard, data interaction through APIs, and telemetry tracing capabilities.
49
-
50
-
## Modify the Project
51
-
You will now include additional code for the purpose of demonstrating computation intense work. Go to the `NetAspire.Arm.ApiService` project, and create a new file `ComputationService.cs`. Add the code shown below to this file:
This code defines a static class, ComputationService, designed to perform computationally intensive tasks, specifically matrix multiplication. It contains a public method, PerformIntensiveCalculations, which generates two matrices of a specified size, multiplies them, and stores the resulting matrix.
85
-
86
-
The private method GenerateMatrix creates a one-dimensional array representing a matrix of the given size (matrixSize x matrixSize). Each element in the matrix is initialized with a random double value generated using Random.Shared.NextDouble().
87
-
88
-
The public method PerformIntensiveCalculations multiplies two matrices (matrix1 and matrix2) element by element using nested loops and LINQ. It iterates through each row of the first matrix and each column of the second matrix, calculating the dot product for each element in the resulting matrix. The result of the multiplication is stored in a flattened one-dimensional array, matrixResult.
89
-
90
-
This code is provided for demonstrating heavy computational operations, such as large matrix manipulations, and can simulate workloads in scenarios that mimic intensive data processing or scientific calculations.
91
-
92
-
Then, open the `Program.cs` file in the `NetAspire.Arm.ApiService` directory and add modify the `MapGet` function of the app as shown:
This will trigger matrix multiplications when you click Weather in the web frontend application.
112
-
113
-
To test the code, re-run the application using the following command:
114
-
115
-
```console
116
-
dotnet run --project NetAspire.Arm.AppHost
117
-
```
118
-
119
-
Next, navigate to the web frontend, click Weather, and then return to the dashboard. Click Traces to observe that the operation now takes significantly longer to complete—approximately 4 seconds in the example below:
120
-
121
-

122
-
123
-
You are now ready to deploy the application to the cloud.
0 commit comments