2026-06-19

How to Fix Blazor Kestrel Error: Unsupported Compression Method for Static HTML

If you are building a Blazor application and need to serve static HTML files directly (like a design system, documentation, or legacy pages), you probably tossed them straight into your wwwroot folder.

Everything works beautifully in your production environment. But when you hit F5 to test locally, you are greeted with a nasty System.IO.InvalidDataException crash in your Kestrel server logs:

fail: Microsoft.AspNetCore.Server.Kestrel Connection id "...", Request id "...": An unhandled exception was thrown by the application. System.IO.InvalidDataException: The archive entry was compressed using an unsupported compression method. at System.IO.Compression.Inflater.Inflate(FlushCode flushCode) ... at Microsoft.AspNetCore.Watch.BrowserRefresh.ResponseStreamWrapper.DisposeAsync()

The Root Cause: Local Browser Refresh Tooling

At first this looked strange, because I was not using any custom compression code. The problem turned out to be related to the development-time BrowserLink / Browser Refresh pipeline in ASP.NET Core, not the HTML file itself.

This error is not a bug in my code, nor is it an issue with the HTML files. It is caused by a known development-time bug in ASP.NET Core's Hot Reload / Browser Refresh middleware.

When you run your project locally, Visual Studio (version 2026) or the dotnet watch CLI dynamically injects a tiny JavaScript snippet into your HTML responses. This script allows your browser to automatically refresh when you save changes in your code.

However, when you directly request a static .html file from wwwroot in development, the BrowserRefreshMiddleware attempts to read the underlying data stream to inject its script. If the framework compresses or buffers this static stream under certain local configurations, the middleware misinterprets the compression headers, corrupts the stream, and crashes Kestrel.

In .NET 10, static assets can be processed through the SDK's static web assets pipeline. In development, BrowserLink tries to inject its refresh script into HTML responses. That is usually fine for normal HTML, but if the response is being served through the compressed static asset path, the browser refresh middleware can fail while trying to rewrite it.

That is why the issue appeared only for HTML files and not for images like:

	https://localhost:7075/assets/logo/blazor.png

Images do not get HTML script injection, so they do not hit the same BrowserLink path.

Why does it work in Production?

This issue completely vanishes in production because Hot Reload and Browser Refresh tools are entirely stripped out when your app runs outside of the Development environment.


How to Fix It

Since the problem lies entirely within local development tooling, you can fix it by telling ASP.NET Core to skip loading the browser tools for your debugging profile.

Solution 1: Update launchSettings.json (Recommended)

The cleanest fix is to append an environment variable to your local launch profile. This fixes the issue for anyone pulling down your repository without breaking their global IDE settings.

  1. Open your project's Properties/launchSettings.json file.
  2. Locate the profile you use to run the application (e.g., "https" or "http").
  3. Under the "environmentVariables" object, add "ASPNETCORE_HOSTINGSTARTUPEXCLUDEASSEMBLIES": "Microsoft.WebTools.BrowserLink.Net".

Your configuration file should look like this:

"profiles": { "https": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy", "applicationUrl": "https://localhost:7075;http://localhost:5242", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", "ASPNETCORE_HOSTINGSTARTUPEXCLUDEASSEMBLIES": "Microsoft.WebTools.BrowserLink.Net" } } }

Solution 2: Disable via Visual Studio Settings

If you prefer a global fix across your IDE without altering your source control files, you can turn off the features directly inside Visual Studio:

  1. Click the dropdown arrow next to the Hot Reload button (the fire icon 🔥) in the top toolbar and uncheck Enable Hot Reload on File Save.
  2. Click the dropdown arrow next to the Browser Link icon in the toolbar and uncheck Enable Browser Link.

Other quick fixes or debugging (use wisely in Production env):

  1. Clear browser cache and rebuild
    • Close the browser entirely.
    • Delete bin/ and obj/ folders locally.
    • In Visual Studio: Build → Clean Solution, then Build → Build Solution.
    • Run the app fresh (F5).

  2. Disable gzip compression for static files temporarily (test if it's the culprit)
    • Open Program.cs.
    • Look for lines with .UseResponseCompression() or gzip middleware.
    • Temporarily comment them out or add a condition to skip .html files.
    • Rebuild and test.

  3. Added this to [YOUR_PROJECT.csproj]:
    • <DisableBuildCompression>true</DisableBuildCompression>
      or
      <DisableBuildCompression Condition="'$(Configuration)' == 'Debug'">true</DisableBuildCompression>

Summary

When serving raw HTML assets straight out of wwwroot, local stream manipulation by .NET's developer tools can accidentally break payload compression. By excluding BrowserLink.Net from your development startup assemblies, you bypass the buggy middleware entirely, making your local development environment behave exactly like your stable production server.

2026-06-18

How to Install OpenAI Codex CLI on Windows (and Fix 404 Not Found Errors)

Setting up your terminal environment for local AI-assisted engineering tools is amazing—until your initial installation command hits a roadblock. If you attempted to set up OpenAI Codex and were blocked by an registry error, you are not alone.

The Problem: npm error code E404

When running a guessed or outdated package command in the Windows Command Prompt, the npm registry throws a missing resource exception:

C:\Users\User>npm install -g @openai/codex-cli npm error code E404 npm error 404 Not Found - GET https://npmjs.org - Not found npm error 404 The requested resource '@openai/codex-cli@*' could not be found...

Why this happens: The package identifier name @openai/codex-cli does not exist on the npm server. The core executable CLI logic is bundled directly inside the foundational engine scope name.

The Solution: Step-by-Step Installation Guide

Follow these steps to clean up your environment registry context and download the correct global binaries securely:

  1. Run the Correct Package Command: Open your terminal window and point npm to the official, integrated framework tool distribution location:
    npm install -g @openai/codex@latest
  2. Verify Package Linkage Success: Once terminal dependency resolution completes, it will report the package structural allocation:
    added 7 packages in 31s
  3. Query the System Shell Mapping: Confirm your system execution PATH variables accurately point to the newly registered node engine variables by checking the deployment version:
    codex --version
    You will see the active system architecture footprint print out cleanly:
    codex-cli 0.141.0


Launching Your Agent Environment

Now that the CLI is correctly linked to your terminal profile, you can open up your local interactive development session instantly by inputting:

codex --interactive

💡 Troubleshooting Tips for AI IDE Engineers

Missing Binary Fallbacks: On isolated Windows machines, if your global npm prefix scripts are blocked by Execution Policies, bypass npm completely. Head to the official repository releases, download codex-x86_64-pc-windows-msvc.exe, drop it into your local directory, and rename it to codex.exe.

Google Antigravity Mapping: If you are moving this workflow into the Google Antigravity IDE workspace, you don't even need npm dependencies! Use the internal extension channel path instead:

/plugin marketplace add obra/superpowers-marketplace
/plugin install superpowers@superpowers-marketplace

2026-06-08

How to Crawl and Download Your Localhost Site as Static HTML on Windows

Have you ever built a beautiful local web application and needed to extract it into static HTML files? Maybe you want to backup a local database-driven project, preview a static build, or archive a site.

If you are on Windows and tried to install:

winget install GNU.Wget
and you may get error message:
No package found matching input criteria.

or typing a quick wget command into PowerShell like:

wget.exe --no-check-certificate --recursive --page-requisites --adjust-extension --convert-links --no-parent https://localhost:7249/
You probably got smacked with a nasty, confusing error message:
Invoke-WebRequest : A positional parameter cannot be found that accepts argument '--recursive'.

Don't worry, you didn't write the command wrong. You just fell into a classic Windows PowerShell trap! Here is exactly why that happens and how to easily crawl your https://localhost site with the real tool in under two minutes.


The PowerShell identity crisis: Why wget failed

By default, Windows PowerShell uses aliases (shortcuts). When you type wget, PowerShell doesn't actually run the famous GNU Wget data-grabbing tool. Instead, it secretly runs its own built-in command called Invoke-WebRequest.

Because Microsoft’s tool doesn't understand advanced web crawling flags like --recursive or --page-requisites, it crashes instantly.

To fix this, we need to install the authentic, full-powered version of GNU Wget on your system.


Step 1: Install the real GNU wget tool

Windows 10 and 11 come with a built-in package manager called winget. We will use it to pull down the correct software.

  1. Open your PowerShell window.
  2. Run this exact command to target the authentic application ID:
winget install -e --id JernejSimoncic.Wget

(If prompted to accept source agreements, simply type Y and press Enter).


Step 2: Refresh your terminal environment

Once the installer finishes, the system needs to recognize the newly added software paths.

  1. Close your current PowerShell window completely.
  2. Open a brand new PowerShell window.
  3. Navigate to the exact folder where you want your static HTML files to drop:
cd "C:\Users\YourUsername\Desktop\MyStaticSite"

Step 3: Run the magic localhost crawl command

Now we execute the crawl. To bypass PowerShell's fake shortcut, we explicitly add .exe to our command.

If your local development site is running on an HTTPS port (e.g., https://localhost:7249/), execute this line:

wget.exe --no-check-certificate --recursive --page-requisites --adjust-extension --convert-links --no-parent https://localhost:7249/

What do all those flags actually do?

  • --no-check-certificate: Crucial for local dev environments! It forces the crawler to ignore self-signed SSL/TLS certificate warnings.
  • --recursive: Tells the tool to map out your site layout and follow local links automatically.
  • --page-requisites: Grabs all assets required to render the site properly offline (CSS stylesheets, background images, and scripts).
  • --adjust-extension: Automatically appends .html to raw local routing endpoints so your web browser can open them like normal files.
  • --convert-links: Rewrites the internal code paths so your local files point to each other instead of trying to look for the live web server.

How to uninstall it

Open your PowerShell window and run:

winget uninstall JernejSimoncic.Wget

The Result

Once the script finishes downloading, check your directory! You will find a brand-new folder named localhost:7249.

Inside, you will find a fully functional, offline-ready index.html alongside neatly organized folders containing your JavaScript, style sheets, and local media assets. You can open index.html in any browser, and your site layout will render completely intact without requiring your local development server to be turned on!

Developer Note: Keep in mind that static crawlers like wget download raw elements rendered by the server. If your localhost application depends entirely on runtime client-side frameworks (like React or Angular components fetching API data dynamically after the page loads), you may need to use an automated browser script like Puppeteer instead.

2026-01-06

Why Your SQL Server 2025 Isn't Connecting: Diagnosing Network and Instance-Specific Errors in SQL Server Management Studio (SSMS) New UI

If you've ever tried to connect to a SQL Server and received an error message like "Could not open a connection to SQL Server" or "Named Pipes Provider: error 40," you know how frustrating it can be. But don’t worry—these errors are common, and fixing them is often straightforward once you understand the root causes.


This issue has become far more common in recent versions of SQL Server Management Studio (SSMS) 21 and 25, not because the problem is new, but because the new UI has changed in ways that actively hide critical connection options. 
  • Expand the Connection Window: You may notice that the "Browse" section is hidden. To fix this, expand the connection window to see the full interface.

  • Adjust the Window Size: Look at the top-right corner of the SSMS window. Drag the edges of the window to resize it so that you can see the "Browse" section and hierarchy more clearly.

  • Select the Server: Once you resize the window, you should see the hierarchy on the left under "Local." The "Server Name" field will now be visible, allowing you to select the appropriate server.

  • Choose the Correct Server: Click on your server, in this case, it should show something like LAPTOP-XXXXX\SQLEXPRESS2025.



2024-08-16

Malaysia GDP Growth Rate 馬來西亞國內生產總值

Period GDP Growth Rate (%) Notes (Draft, update in progress)
1987 5.2% 1987年10月27日展开茅草行动(Operasi Lalang)。
1988 9.9% 1988年8月,長達八年的伊朗-伊拉克戰爭結束了。
1989 9.1% 馬哈迪連任,吉隆坡雙子塔(Petronas Towers, KLCC)的建設計劃正式啟動; 11月9日,柏林圍牆倒塌,標誌著冷戰結束和東西德統一的開始;東歐革命;蘇聯解體的先兆;日本股市泡沫破裂。
1990 9.0% 政府經濟改革措施帶動增長;德國統一:1990年10月3日,東德和西德正式統一;1990年8月2日,伊拉克入侵科威特,觸發了波斯灣戰爭;“沙漠風暴”行動;日本房市泡沫破裂。
1991 9.5% 馬哈迪推介Wawasan2020 宏願; 1991年12月25日,蘇聯總統戈爾巴喬夫宣布蘇聯解體;波斯灣戰爭結束:1991年1月17日至2月28日,聯合國聯軍發動“沙漠風暴”行動,成功驅逐伊拉克軍隊出科威特,結束了波斯灣戰爭; 日本經濟泡沫破裂。
1992 8.9% 全球經濟復甦,美國與歐洲走出衰退;亞洲製造業出口持續增長。馬來西亞受惠於電子與製造業需求。
1993 9.9% 東南亞「亞洲四小虎」高速增長期,外資大量流入;馬來西亞股市與房地產市場繁榮。
1994 9.2% 北美自由貿易協定 (NAFTA) 生效,全球貿易活躍;馬來西亞製造業與出口持續擴張。
1995 9.8% 世界貿易組織 (WTO) 在 1995 年正式成立,全球貿易自由化加速。政府推動基建與工業化,製造業與出口表現強勁。
1996 10.0% 外資流入與製造業擴張。
1997 7.3% 亞洲金融風暴。
1998 -7.4% 亞洲金融風暴後遺症。馬來西亞拒絕 IMF 救助,實施資本管制與固定匯率政策 (RM3.80 對美元)。
1999 6.1% 政府採取刺激措施,經濟逐步復甦。科技產業開始回暖。
2000 8.9% 全球科技熱潮促進出口。
2001 0.5% dot-com泡沫破裂。
2002 5.4% 全球經濟在 dot-com 泡沫後逐步回穩;馬來西亞出口電子與棕櫚油表現良好。
2003 5.8% SARS疫情影響。
2004 6.8% 中國快速成長帶動東南亞出口;馬來西亞受惠於原材料與製造業。
2005 5.3% 全球油價上漲,馬來西亞作為產油國受益;但國內通膨壓力增加。
2006 5.6% 全球經濟穩定成長,馬來西亞持續推動基建與製造業投資。
2007 6.3% 全球金融市場繁榮,馬來西亞出口與投資保持強勁;但美國次貸危機開始浮現。
2008 4.8% 全球油價飆升、全球金融危机、次級房貸泡沫爆破,雷曼兄弟倒閉,負債高達 6130 億美元。全球經濟估計損失高達 10 兆美元。馬來西亞歷史上第一次有州層級的政黨輪替,吉打、霹靂、檳城與雪蘭莪州政權首次由反對黨(民聯)接管, 吉蘭丹由伊斯蘭黨(PAS)奪下。
2009 -1.5% 全球金融危機後遺症。因政治跳槽事件,霹靂重新回到國陣。
2010 7.4% 全球經濟復甦。
2011 5.3% 歐債危機影響全球市場;馬來西亞保持中速增長,依靠內需與公共支出。
2012 5.5% 國內政治穩定,外部經濟不確定性。
2013 4.7% 政治改革與不穩定的全球市場。
2014 6.0% 政府增加公共支出與基建投資。
2015 5.1% 油價下跌,1MDB 醜聞爆發,政治動盪。
2016 4.4% 全球需求疲軟與政治不確定性。
2017 5.8% 政府推動經濟改革,全球需求回升。美國川普政府上台,推動減稅與貿易保護政策;全球股市普遍上漲。
2018 4.8% 第 14 屆大選,希盟(Pakatan Harapan)勝選,馬哈迪重返政壇,全國政權第一次更替。柔佛、馬六甲、森美蘭等州也出現政權更替。同時,美中貿易戰爆發。
2019 4.4% 政治不穩與外部需求下降。美中貿易戰升級,全球經濟放緩;英國脫歐進程持續造成歐洲市場不確定性。
2020 -5.5% Covid 疫情爆發。二月發生「喜來登政變」(Sheraton Move),希盟政府垮台。
2021 3.3% Covid-19疫情後經濟復甦。
2022 8.7% 第15屆大選於 11 月 19 日 舉行,結果出現懸峙國會,最終由安華領導的 希盟 組成「團結政府」。俄烏戰爭爆發,能源與食品價格飆升。
2023 3.7% 全球經濟放緩。安華政府推動「馬來西亞團結政府」政策,強調財政改革與反貪。
2024 5.1% 政府加大公共支出與基建投資,推動「新工業大藍圖 (NIMP 2030)」與「馬來西亞數位經濟藍圖 (MyDIGITAL)」。內需回升,帶動成長。