Skip to content

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy

Category: Asp.Net Core

Asp.Net Core

.NET Core Configuration Spreads Across Files

- 13.01.26 - ErcanOPAK comment on .NET Core Configuration Spreads Across Files

Hard to reason about. WhyFlat config keys lack structure. Tip Use strongly typed configuration objects.

Read More
Asp.Net Core

ASP.NET Core Apps Scale Poorly Under Burst Traffic

- 13.01.26 - ErcanOPAK comment on ASP.NET Core Apps Scale Poorly Under Burst Traffic

Handles average load fine. WhyThread pool starvation during spikes. Tip Avoid blocking calls and tune concurrency.

Read More
Asp.Net Core

.NET Core Configuration Grows Unmanageable

- 12.01.26 - ErcanOPAK comment on .NET Core Configuration Grows Unmanageable

Too many settings. WhyFlat configuration structure. Tip Group settings into strongly typed sections.

Read More
Asp.Net Core

ASP.NET Core Apps Start Slowly

- 12.01.26 - ErcanOPAK comment on ASP.NET Core Apps Start Slowly

First request is painful. WhyCold start and lazy service initialization. Tip Warm up critical paths on startup.

Read More
Asp.Net Core

.NET Core Background Services Stop Silently

- 11.01.26 - ErcanOPAK comment on .NET Core Background Services Stop Silently

No crash, no logs. WhyUnhandled exceptions inside background tasks. Fix Wrap ExecuteAsync with global exception handling.

Read More
Asp.Net Core

ASP.NET Core Apps Consume More Memory Over Time

- 11.01.26 - ErcanOPAK comment on ASP.NET Core Apps Consume More Memory Over Time

GC works, memory still grows. WhyObject pooling misused. Fix Return pooled objects immediately after use.

Read More
Asp.Net Core

.NET Core Logging Hurts Performance

- 07.01.26 - ErcanOPAK comment on .NET Core Logging Hurts Performance

Logs enabled, throughput drops. WhySynchronous sinks block execution. Fix Use async logging providers.

Read More
Asp.Net Core

ASP.NET Core Apps Feel Slower Over Time

- 07.01.26 - ErcanOPAK comment on ASP.NET Core Apps Feel Slower Over Time

No memory leak detected. WhyThread pool starvation under burst load. Fix Avoid blocking calls in async pipelines.

Read More
Asp.Net Core

.NET Core Memory Grows Without Leaks

- 06.01.26 - ErcanOPAK comment on .NET Core Memory Grows Without Leaks

GC runs but memory stays high. WhyLarge object heap fragmentation. FixReuse large buffers.

Read More
Asp.Net Core / C#

ASP.NET Core Requests Hang Randomly

- 06.01.26 - ErcanOPAK comment on ASP.NET Core Requests Hang Randomly

No exceptions thrown. WhyThread starvation due to sync-over-async. Fix await Task.Run(() => AsyncMethod()).ConfigureAwait(false);  

Read More
Asp.Net Core

Configuration Reload Breaks Running Requests

- 05.01.26 - ErcanOPAK comment on Configuration Reload Breaks Running Requests

Hot reload causes instability. WhyOptions snapshot changes mid-request. Fix Use IOptionsMonitor carefully.

Read More
Asp.Net Core

ASP.NET Core Background Tasks Stop Randomly

- 05.01.26 - ErcanOPAK comment on ASP.NET Core Background Tasks Stop Randomly

Works until traffic spikes. WhyTasks tied to request lifetime. Fix Use IHostedService for background work.

Read More
Asp.Net Core

Dependency Injection Causes Memory Bloat

- 04.01.26 - ErcanOPAK comment on Dependency Injection Causes Memory Bloat

Memory grows over time. WhyTransient services holding unmanaged resources. FixDispose resources explicitly or use scoped lifetime.

Read More
Asp.Net Core / C#

ASP.NET Core Thread Pool Starves Under Load

- 04.01.26 - ErcanOPAK comment on ASP.NET Core Thread Pool Starves Under Load

Requests queue endlessly. WhyLong-running sync tasks block threads. Fix await Task.Run(LongRunningWork);  

Read More
Asp.Net Core

Logging Slows Down ASP.NET Core APIs

- 03.01.26 - ErcanOPAK comment on Logging Slows Down ASP.NET Core APIs

Logs enabled, throughput drops. WhySynchronous logging blocks request threads. FixUse async logging providers.

Read More
Asp.Net Core / C#

ASP.NET Core Memory Usage Keeps Growing

- 03.01.26 - ErcanOPAK comment on ASP.NET Core Memory Usage Keeps Growing

GC runs, memory stays high. WhyObject pooling misused or ignored. Fix services.AddPooledDbContextFactory<AppDbContext>();  

Read More
Asp.Net Core

Configuration Differs Between Environments

- 03.01.26 - ErcanOPAK comment on Configuration Differs Between Environments

Works locally, breaks in prod. WhyConfiguration provider order. FixLog final config at startup.

Read More
Asp.Net Core / C#

ASP.NET Core Requests Hang Under Load

- 03.01.26 - ErcanOPAK comment on ASP.NET Core Requests Hang Under Load

CPU low, threads exhausted. WhyBlocking calls inside async pipeline. Fix await SomeAsyncMethod();  

Read More
Asp.Net Core

Middleware Order Breaks Security

- 02.01.26 - ErcanOPAK comment on Middleware Order Breaks Security

Auth enabled, still vulnerable. WhyMiddleware pipeline order matters. Fix Authentication must come before authorization.

Read More
Asp.Net Core

ASP.NET Core Memory Grows Forever

- 02.01.26 - ErcanOPAK comment on ASP.NET Core Memory Grows Forever

No leaks detected. WhySingleton services holding scoped dependencies. Fix Avoid injecting scoped services into singletons.

Read More
Asp.Net Core

Configuration Values Change Between Environments

- 01.01.26 - ErcanOPAK comment on Configuration Values Change Between Environments

Works locally, breaks in prod. Why it happensConfiguration providers load order. FixLog final configuration on startup.

Read More
Asp.Net Core

ASP.NET Core Requests Hang Randomly

- 01.01.26 - ErcanOPAK comment on ASP.NET Core Requests Hang Randomly

CPU low, threads exhausted. Why it happensBlocking calls inside async pipeline. FixRemove .Result and .Wait().

Read More
Asp.Net Core

.NET Core — IHttpContextAccessor Is Not Free

- 31.12.25 - ErcanOPAK comment on .NET Core — IHttpContextAccessor Is Not Free

It adds overhead per request. Tip Avoid in hot paths.

Read More
Asp.Net Core

.NET Core — Thread Pool Starvation Looks Like CPU Idle

- 31.12.25 - ErcanOPAK comment on .NET Core — Thread Pool Starvation Looks Like CPU Idle

CPU low, requests slow. Cause Blocking async code. Fix Eliminate .Wait() / .Result.

Read More
Asp.Net Core

.NET Core — UseHttpsRedirection Breaks Proxies

- 30.12.25 - ErcanOPAK comment on .NET Core — UseHttpsRedirection Breaks Proxies

Behind reverse proxies, HTTPS may loop. ✅ Fix Use forwarded headers middleware.

Read More
Asp.Net Core

.NET Core — AddSingleton + State = Data Corruption

- 30.12.25 - ErcanOPAK comment on .NET Core — AddSingleton + State = Data Corruption

Singletons live forever. ❌ Risk Cross-request data leakage. ✅ Rule Never store request-specific state in singletons.

Read More
Asp.Net Core

.NET Core — ProblemDetails Improves API Debugging

- 29.12.25 - ErcanOPAK comment on .NET Core — ProblemDetails Improves API Debugging

Standardized error responses save hours. ✅ Benefit Consistent client handling Better logging

Read More
Asp.Net Core

.NET Core — Middleware Exceptions Bypass Filters

- 29.12.25 - ErcanOPAK comment on .NET Core — Middleware Exceptions Bypass Filters

Exceptions thrown in middleware skip MVC filters. ✅ Fix Handle critical errors inside middleware itself.

Read More
Asp.Net Core / C#

Background Tasks the Right Way

- 29.12.25 - ErcanOPAK comment on Background Tasks the Right Way

The Problem: You are firing off Task.Run() in a controller and hoping it finishes, but the server kills it. The Fix: Implement BackgroundService. It’s the reliable, built-in way to run long-running processes. public class Worker : BackgroundService { protected override async Task ExecuteAsync(CancellationToken stoppingToken) { while (!stoppingToken.IsCancellationRequested) { // Your logic here await Task.Delay(1000, stoppingToken); […]

Read More
Asp.Net Core / C#

Hot Reload Configuration with IOptionsSnapshot

- 29.12.25 - ErcanOPAK comment on Hot Reload Configuration with IOptionsSnapshot

The Problem: You changed a value in appsettings.json, but the app keeps using the old value until you restart the server. The Fix: Inject IOptionsSnapshot<T> instead of IOptions<T>. It reads the config file every time the request is made. public class MyService { private readonly MySettings _settings; // Updates immediately when json changes! public MyService(IOptionsSnapshot<MySettings> […]

Read More
Page 4 of 7
« Previous 1 2 3 4 5 6 7 Next »

Posts pagination

« Previous 1 2 3 4 5 6 7 Next »
April 2026
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
27282930  
« Mar    

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (950)
  • How to add default value for Entity Framework migrations for DateTime and Bool (865)
  • Get the First and Last Word from a String or Sentence in SQL (837)
  • How to select distinct rows in a datatable in C# (806)
  • How to make theater mode the default for Youtube (754)
  • Add Constraint to SQL Table to ensure email contains @ (578)
  • How to enable, disable and check if Service Broker is enabled on a database in SQL Server (564)
  • Average of all values in a column that are not zero in SQL (534)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (491)
  • Find numbers with more than two decimal places in SQL (449)

Recent Posts

  • C#: Use Init-Only Setters for Immutable Objects After Construction
  • C#: Use Expression-Bodied Members for Concise Single-Line Methods
  • C#: Enable Nullable Reference Types to Eliminate Null Reference Exceptions
  • C#: Use Record Types for Immutable Data Objects
  • SQL: Use CTEs for Readable Complex Queries
  • SQL: Use Window Functions for Advanced Analytical Queries
  • .NET Core: Use Background Services for Long-Running Tasks
  • .NET Core: Use Minimal APIs for Lightweight HTTP Services
  • Git: Use Cherry-Pick to Apply Specific Commits Across Branches
  • Git: Use Interactive Rebase to Clean Up Commit History Before Merge

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (950)
  • How to add default value for Entity Framework migrations for DateTime and Bool (865)
  • Get the First and Last Word from a String or Sentence in SQL (837)
  • How to select distinct rows in a datatable in C# (806)
  • How to make theater mode the default for Youtube (754)

Recent Posts

  • C#: Use Init-Only Setters for Immutable Objects After Construction
  • C#: Use Expression-Bodied Members for Concise Single-Line Methods
  • C#: Enable Nullable Reference Types to Eliminate Null Reference Exceptions
  • C#: Use Record Types for Immutable Data Objects
  • SQL: Use CTEs for Readable Complex Queries

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com