[{"id":"aspnetcoreadvanced-001","courseId":"aspnet-core-advanced","domain":"hosting-and-middleware","topic":"Kestrel request body size limit","prompt":"A custom middleware runs after the action has started reading the request body. It wants to raise MaxRequestBodySize for this request. Which property tells it whether that change is still allowed?","hint":"The limit is exposed as a feature on the request. Look for a flag on that feature that reports its state.","explain":"Kestrel caps how large each request body may be, and middleware can change that cap for one request. The change is only valid before the body is read, so the feature has to report its state.","source":"https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel/options#maximum-request-body-size","interaction":{"type":"single"},"options":[{"id":"a","text":"IHttpMaxRequestBodySizeFeature.IsReadOnly","why":"IsReadOnly reports whether MaxRequestBodySize can still be set safely for this request."},{"id":"b","text":"KestrelServerLimits.MaxRequestBodySize","whyNot":"That is the server-wide setting in ConfigureKestrel, not a per-request state."},{"id":"c","text":"HttpRequest.ContentLength","whyNot":"ContentLength is the size the client declared for the body; it doesn't say whether the limit can still change."},{"id":"d","text":"IHttpMaxRequestBodySizeFeature.MaxRequestBodySize","whyNot":"That property holds the limit itself. Reading or setting it doesn't tell the middleware whether the change is still allowed."}],"answer":"a","explanation":"IHttpMaxRequestBodySizeFeature lets middleware change a request's body size limit, and its IsReadOnly property shows whether that change is still safe.","concept":"IHttpMaxRequestBodySizeFeature lets middleware change a request's body size limit, and its IsReadOnly property shows whether that change is still safe.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["Set a request's body size limit before its body is read; later changes throw an exception."]},{"id":"aspnetcoreadvanced-002","courseId":"aspnet-core-advanced","domain":"hosting-and-middleware","topic":"Kestrel HTTP/2 limits","prompt":"In Kestrel's HTTP/2 settings, KeepAlivePingDelay is how long the server waits for a reply to its ping before it closes the connection.","hint":"Two separate keep-alive settings each do one job. Consider which one decides when a ping is sent.","explain":"HTTP/2 keep-alive pings keep idle connections alive and detect peers that have gone silent. Two separate settings handle the ping schedule and the reply deadline.","source":"https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel/options","interaction":{"type":"true-false"},"options":[{"id":"a","text":"True","whyNot":"That describes KeepAlivePingTimeout. KeepAlivePingDelay sets when the server sends a ping on an idle connection."},{"id":"b","text":"False","why":"KeepAlivePingDelay is the interval before a ping is sent; KeepAlivePingTimeout closes the connection if no frame arrives in time."}],"answer":"b","explanation":"KeepAlivePingDelay sets how long the server waits before sending a keep-alive ping; KeepAlivePingTimeout closes the connection if no frame arrives within its time.","concept":"KeepAlivePingDelay sets how long the server waits before sending a keep-alive ping; KeepAlivePingTimeout closes the connection if no frame arrives within its time.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["KeepAlivePingDelay schedules pings; KeepAlivePingTimeout decides when a silent connection is closed."]},{"id":"aspnetcoreadvanced-003","courseId":"aspnet-core-advanced","domain":"hosting-and-middleware","topic":"IIS out-of-process hosting","prompt":"An ASP.NET Core app runs out-of-process behind IIS. Clients reach the site over HTTPS on port 443. On which port does the app's Kestrel server listen?","hint":"Think about which port IIS keeps for the public site, and what the module does with the traffic.","explain":"Out-of-process, IIS and the app run in separate processes, and a module forwards each request between them. Consider which port the public site uses and which port the module uses internally.","source":"https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/index#out-of-process-hosting-model","interaction":{"type":"single"},"options":[{"id":"a","text":"A random port that isn't 80 or 443, passed to the app by the ASP.NET Core Module","why":"The module sets the port through an environment variable at startup, and that port is never 80 or 443."},{"id":"b","text":"Port 80, the HTTP port IIS listens on for the site","whyNot":"IIS keeps the site's port; the module forwards requests to Kestrel on a different port."},{"id":"c","text":"Port 443, because the module forwards HTTPS traffic to Kestrel unchanged","whyNot":"The module doesn't support HTTPS forwarding, so requests reach Kestrel over HTTP."},{"id":"d","text":"A fixed port that the app chooses in Program.cs","whyNot":"The module chooses the port at startup, so the app doesn't pick one for IIS."}],"answer":"a","explanation":"Out-of-process, the ASP.NET Core Module forwards requests over HTTP to Kestrel on a random port that isn't 80 or 443, set through an environment variable.","concept":"Out-of-process, the ASP.NET Core Module forwards requests over HTTP to Kestrel on a random port that isn't 80 or 443, set through an environment variable.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["Behind IIS out-of-process, Kestrel never listens on the public ports 80 or 443."]},{"id":"aspnetcoreadvanced-004","courseId":"aspnet-core-advanced","domain":"hosting-and-middleware","topic":"Docker multi-stage builds","prompt":"A Dockerfile builds the app in a dotnet/sdk stage, then runs it from a final dotnet/aspnet stage. Which TWO statements about the final image are true?","hint":"Think about what each stage of a multi-stage build is for, and what the final image needs to run the app.","explain":"A multi-stage build uses one image to compile the app and a different image to run it. The image chosen for each stage decides which tools end up in the final container.","source":"https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/docker/building-net-docker-images","interaction":{"type":"multiple","tellCount":true},"options":[{"id":"a","text":"It contains the ASP.NET Core runtime and libraries and is optimized for running apps in production.","why":"The aspnet image is built for production: it holds the runtime and libraries needed to run an app."},{"id":"b","text":"It includes the SDK so the app can be compiled again when the container starts.","whyNot":"The page says dynamic code compilation isn't needed in the Docker model, because the app is already published."},{"id":"c","text":"Only the binaries and content needed to run the app are copied into it from the build stage.","why":"The final stage copies just the published output, which is the binaries and content needed to run the app."},{"id":"d","text":"It is the larger image, because it carries the build tools into production.","whyNot":"The SDK image is the relatively large one; the aspnet image is relatively small."},{"id":"e","text":"It is the image for debugging, since it keeps the source code and build tools.","whyNot":"The SDK image is the one optimized for local development and debugging, not the runtime image."},{"id":"f","text":"It runs with dotnet run against project source copied from the build stage.","whyNot":"The sample's final stage starts the published DLL with dotnet aspnetapp.dll instead."}],"answer":"ac","explanation":"The dotnet/aspnet image holds only the runtime and libraries for production, and a multi-stage build copies just the published output into the final stage.","concept":"The dotnet/aspnet image holds only the runtime and libraries for production, and a multi-stage build copies just the published output into the final stage.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["Build with the SDK image, then ship only the published output on the smaller aspnet image."]},{"id":"aspnetcoreadvanced-005","courseId":"aspnet-core-advanced","domain":"hosting-and-middleware","topic":"Dockerfile restore layer caching","prompt":"Your Dockerfile copies the *.csproj files and runs dotnet restore as its own layer, then copies the rest of the source. A teammate edits one .cs file, leaves the project files alone, and runs docker build. What happens to the restore step?","hint":"Consider which files the restore layer depends on, and whether the teammate changed any of them.","explain":"Docker reuses a build layer when its inputs haven't changed. Copying files in a deliberate order lets slow steps depend only on the files they actually need.","source":"https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/docker/building-net-docker-images","interaction":{"type":"single"},"options":[{"id":"a","text":"The cached restore layer is reused, and dotnet restore does not run again.","why":"Restore only needs to run again when the .csproj files change, so the cached restore layer is reused."},{"id":"b","text":"dotnet restore runs again, because any change to the source invalidates every layer.","whyNot":"The restore layer is built from the project files before the source is copied, so a .cs edit doesn't rebuild it."},{"id":"c","text":"dotnet restore runs again only if the build is run with --no-cache.","whyNot":"Restore also runs again when the .csproj files change, so --no-cache isn't the only trigger."},{"id":"d","text":"dotnet restore runs again, because copying the source after restore breaks the cache.","whyNot":"Copying the source after restore doesn't invalidate the restore layer, which comes before it."}],"answer":"a","explanation":"Copying only the .csproj files before dotnet restore lets Docker reuse the restore layer while the project files stay unchanged.","concept":"Copying only the .csproj files before dotnet restore lets Docker reuse the restore layer while the project files stay unchanged.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["Copy project files and run restore before copying the source to keep restore cached."]}]