NET Centric Computing · Unit 10
Deployment, Cloud Services and Containerization
Exam-focused notes for Deployment, Cloud Services and Containerization (NET Centric Computing, BIT351): what the TU syllabus asks and how it has actually been tested, with 4 solved past questions from this unit.
Deployment, Cloud Services and Containerization in short
After a web app is built, it must be placed on a server where users can reach it. This chapter covers deployment steps, publishing to Azure, hosting models and Docker containers.
What this unit covers
- ASP.NET Core deployment procedures
- Azure cloud publishing
- Hosting models for ASP.NET Core
- Docker uses and benefits
Hosting models for ASP.NET Core
2081 · 5 marks
Describe any two hosting models for ASP.NET core application. [5]
Azure cloud publishing
2080 · 10 marks
How do you publish application to Azure cloud? Illustrate the concept of SQL injection attack with example and its prevention procedure.[10]
Docker uses and benefits
2081.1 · 5 marks
List the uses of docker. How do you secure controller and action methods? [5]
Show solved answerHide answer
Uses of Docker and Securing Controller/Action Methods
Uses of Docker [2.5 marks]
Docker is a containerization platform that packages applications and their dependencies into lightweight, portable containers. Its main uses include:
-
Application Portability
- Docker containers run consistently across different environments (development, testing, production), eliminating the "it works on my machine" problem.
-
Microservices Architecture
- Docker enables breaking down large applications into small, independent microservices, each running in its own container.
-
Continuous Integration and Continuous Deployment (CI/CD)
- Docker integrates with CI/CD pipelines (Jenkins, GitHub Actions) to automate building, testing, and deploying applications.
-
Isolation and Resource Management
- Each container runs in isolation with its own filesystem, network, and process space, preventing conflicts between applications.
-
Rapid Deployment and Scaling
- Containers start in seconds and can be scaled up or down quickly using orchestration tools like Kubernetes or Docker Swarm.
-
Version Control for Environments
- Docker images can be versioned, allowing rollback to previous application states easily.
-
Simplified Dependency Management
- All dependencies are bundled inside the container image, removing the need to install them separately on the host machine.
Securing Controller and Action Methods in ASP.NET MVC [2.5 marks]
In ASP.NET MVC, controllers and action methods can be secured primarily using the [Authorize] attribute.
1. Using [Authorize] Attribute
The [Authorize] attribute restricts access to authenticated users only.
On a Controller (secures all actions):
[Authorize]
public class AdminController : Controller
{
public ActionResult Dashboard()
{
return View();
}
}
On a specific Action Method:
public class HomeController : Controller
{
[Authorize]
public ActionResult SecretPage()
{
return View();
}
public ActionResult PublicPage()
{
return View();
}
}
2. Role-Based Authorization
Restrict access to users belonging to specific roles:
[Authorize(Roles = "Admin, Manager")]
public ActionResult ManageUsers()
{
return View();
}
3. Using [AllowAnonymous] Attribute
Allows specific actions to be publicly accessible even when the controller is secured:
[Authorize]
public class AccountController : Controller
{
[AllowAnonymous]
public ActionResult Login()
{
return View();
}
public ActionResult Profile()
{
return View();
}
}
4. Global Authorization Filter
Apply authorization globally to all controllers in FilterConfig.cs:
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new AuthorizeAttribute());
}
}
Summary Table
| Method | Scope |
|---|---|
[Authorize] on Controller | All actions in the controller |
[Authorize] on Action | Only that specific action |
[Authorize(Roles="Admin")] | Only users in specified role |
[AllowAnonymous] | Bypasses authorization |
| Global Filter | Entire application |
ASP.NET Core deployment procedures
0 · 5 marks
How do you deploy ASP.NET core applications? List the procedures. [5]
Make Unit 10 stick
Practice BIT351 with flashcards & quizzes