1. How do you build Angular for production?
Use ng build --configuration production to create an optimized production build. It enables optimizations such as minification, tree shaking, and dead-code elimination.
ng build --configuration production
2. What does ng build do?
ng build compiles TypeScript, HTML, and CSS into deployable JavaScript, HTML, and CSS files. It also bundles and optimizes application assets based on the selected configuration.
3. What files are generated in the Angular dist folder?
The dist folder contains compiled HTML, JavaScript, CSS, and static assets. For modern Angular browser builds, output is commonly under dist/<project-name>/browser/.
dist/
└── my-app/
└── browser/
├── index.html
├── main-*.js
├── styles-*.css
└── assets/
Key Point: SSR builds also generate server-side output.
4. How do you deploy Angular with ASP.NET Core?
Build Angular and copy its browser output into the ASP.NET Core application's wwwroot folder. Configure ASP.NET Core to serve static files and handle Angular routes.
app.UseDefaultFiles();
app.UseStaticFiles();
5. Can Angular and ASP.NET Core be deployed separately?
Yes. Angular can be hosted on Azure Static Web Apps, while ASP.NET Core Web API runs on Azure App Service. They communicate through HTTPS.
Angular (Azure Static Web Apps)
|
| HTTPS / JSON
v
ASP.NET Core API (Azure App Service)
|
v
Azure SQL Database
6. Can Angular static files be hosted by ASP.NET Core?
Yes. ASP.NET Core can serve Angular's compiled static files from wwwroot using Static File Middleware.
app.UseStaticFiles();
app.MapFallbackToFile("index.html");
Key Point: The fallback supports Angular client-side routing when hosting a CSR application.
7. How do you deploy Angular to Azure?
Build Angular for production and deploy the output to Azure Static Web Apps or another static hosting service. Azure Static Web Apps supports GitHub Actions-based deployment.
ng build --configuration production
8. How do you deploy ASP.NET Core Web API to Azure?
Publish the ASP.NET Core application and deploy it to Azure App Service, Azure Container Apps, or another supported hosting service.
dotnet publish -c Release -o ./publish
Key Point: Configure production settings, database connections, and secrets on the server.
9. How do you configure production API URLs?
Use Angular environment file replacements or runtime configuration to provide the production API URL. Avoid hardcoding URLs throughout services.
export const environment = {
apiUrl: 'https://api.example.com/api'
};
10. How do you handle CORS when Angular and Web API are deployed separately?
Configure CORS in ASP.NET Core to allow requests from the Angular application's origin. Restrict allowed origins, methods, and headers.
builder.Services.AddCors(o => o.AddPolicy("Angular", p =>
p.WithOrigins("https://app.example.com").AllowAnyHeader().AllowAnyMethod()));
Key Point: Apply the policy using app.UseCors("Angular") in the middleware pipeline.
11. What is a reverse proxy?
A reverse proxy receives client requests and forwards them to backend servers. It can provide load balancing, SSL termination, routing, and caching.
Browser
|
v
Reverse Proxy (Nginx / IIS)
|
+── / → Angular
|
+── /api/* → ASP.NET Core Web API
12. How do you configure Angular routing on a production web server?
Configure the web server to return index.html for Angular client-side routes, while preserving actual static files and API endpoints.
Nginx example:
location / {
try_files $uri $uri/ /index.html;
}
13. Why can refreshing an Angular route produce a 404 after deployment?
Angular routes such as /articles/details are handled by the client-side router. On refresh, the server receives that URL and returns 404 unless an SPA fallback is configured.
Solution: Configure the server to serve index.html for unmatched client-side routes.
14. How do you implement CI/CD for Angular + ASP.NET Core?
Use Azure DevOps Pipelines or GitHub Actions to automate building, testing, and deployment. Angular and ASP.NET Core can use separate or combined pipelines.
Developer → Git Push
|
v
CI/CD Pipeline
|
┌───────┴────────┐
| |
Angular Build .NET Build
| |
Angular Tests .NET Tests
| |
Deploy Frontend Deploy Web API
| |
└───────┬────────┘
|
v
Production
Important Interview Revision Points
|
Concept |
Key Point |
|---|---|
|
|
Builds Angular application |
|
Production Build |
Optimized deployable output |
|
|
Angular build artifacts |
|
|
ASP.NET Core static file directory |
|
|
Serves static assets |
|
|
Supports Angular client-side routes |
|
Azure Static Web Apps |
Angular static hosting |
|
Azure App Service |
ASP.NET Core API hosting |
|
Azure SQL |
Managed SQL Server database |
|
CORS |
Controls cross-origin browser requests |
|
Reverse Proxy |
Routes requests to backend services |
|
SPA Fallback |
Prevents refresh-related route 404s |
|
CI/CD |
Automated build, test, and deployment |
|
Azure DevOps |
CI/CD pipeline platform |
|
GitHub Actions |
GitHub-based automation |
Angular + ASP.NET Core — Deployment Options
|
Deployment |
Angular |
ASP.NET Core |
|---|---|---|
|
Same Server |
ASP.NET Core |
IIS / Kestrel |
|
Separate Servers |
Nginx / IIS |
IIS / Kestrel |
|
Azure |
Azure Static Web Apps |
Azure App Service |
|
Containers |
Nginx container |
.NET container |
Interview priority: Focus particularly on questions 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, and 14.
Key interview takeaway: Build Angular into deployable assets, host the frontend and ASP.NET Core API together or separately, configure CORS and SPA routing correctly, and automate deployment using Azure DevOps or GitHub Actions.