The ASP.NET Core "Web Application" template is best suited for creating ________-based applications.
- Web
- Mobile
- Desktop
- Cloud
The "Web Application" template in ASP.NET Core is designed for creating web-based applications. It provides the necessary structure, libraries, and tools to build web applications that can run on various platforms and browsers.
What is the primary goal of unit testing in ASP.NET Core projects?
- To validate the overall functionality of the application
- To test the entire application as a whole
- To ensure that each component or unit of code works correctly in isolation
- To test only the user interface
Unit testing in ASP.NET Core projects focuses on testing individual components or units of code in isolation. The primary goal is to ensure that each unit functions correctly and meets its specific requirements. This helps in identifying and fixing bugs early in the development process, contributing to the overall stability and reliability of the application.
For an action method to be accessible only by non-authenticated users, you should use the _________ attribute.
- [AllowAnonymous]
- [Authorize]
- [DenyAnonymous]
- [NonAuthenticated]
To make an action method accessible only to non-authenticated (anonymous) users in ASP.NET Core, you should use the [AllowAnonymous] attribute. This attribute overrides any global authorization policies, allowing unrestricted access to the action by users who haven't been authenticated.
When considering zero-downtime deployments, which deployment strategy involves routing traffic gradually to the new version of the application?
- Blue-Green Deployment
- Canary Deployment
- Rolling Deployment
- Shadow Deployment
Canary Deployment is a deployment strategy where a small percentage of production traffic is directed to a new version of an application, allowing for real-world testing while minimizing risk. This approach helps identify issues early and gradually shifts traffic as confidence in the new version grows.
For configuring and extending the functionalities in ASP.NET Core pipeline, the _______ method is used in the Startup.cs file.
- Configure
- ConfigureServices
- Use
- Add
The Configure method in the Startup.cs file is where you can configure and extend the ASP.NET Core request pipeline. It's where you add middleware and define the order in which they should be executed.
When dealing with file downloads in ASP.NET Core, which action result allows you to send a byte array as the response along with a download dialog to the client?
- FileContentResult
- ObjectResult
- JsonResult
- StatusCodeResult
The FileContentResult action result in ASP.NET Core is used to send a byte array as the response along with a download dialog to the client. It's commonly used for file downloads like PDFs, images, or other binary files. The response content is a byte array, and you can specify the file's content type and download filename.
If you want to create a custom middleware, which method signature should it follow?
- Task InvokeAsync(HttpContext context)
- void Configure(IApplicationBuilder app)
- void Execute(HttpContext context)
- Task Run(HttpContext context)
Custom middleware in ASP.NET Core should follow the Task InvokeAsync(HttpContext context) method signature. This method is called for each HTTP request and allows you to implement your custom logic within the middleware.
During user registration, you notice that users can set very simple passwords like "password123". You want to enforce stricter password rules. Where in ASP.NET Core can you set these rules?
- Startup.cs
- appsettings.json
- Identity Configuration
- ConfigureServices
You can enforce stricter password rules in ASP.NET Core Identity Configuration. In the Identity Configuration, you can customize password requirements such as length, required character types, and more to ensure stronger password policies for your application.
When optimizing ASP.NET Core applications for performance, developers often use the _________ server in conjunction with a reverse proxy.
- Kestrel
- Apache
- Nginx
- Tomcat
When optimizing ASP.NET Core applications for performance, developers often use the Kestrel server in conjunction with a reverse proxy like Nginx or Apache. Kestrel is a lightweight, cross-platform web server optimized for ASP.NET Core, and it's often used as the front-end server while a reverse proxy handles tasks like load balancing and SSL termination.
What does "MVC" stand for in the context of ASP.NET Core?
- Model-View-Controller
- Microsoft Visual Core
- Modern Virtual Computing
- Managed View Component
In ASP.NET Core, "MVC" stands for Model-View-Controller. This architectural pattern separates the application into three main components: the Model (for data and logic), the View (for presentation and UI), and the Controller (for handling user input and managing the flow of data). It helps in building structured and maintainable web applications.