วันนี้ได้ช่วยทีมแก้ปัญหาพิเศษมา เป็นการ WebAPI ที่เป็น .NET Core 3.1 บน Windows Server 2012 พ2 (มัน EOS ในอีกไม่กี่วันครับ)
ปัญหา
- ปัญหาตอน Start webapi ด้วยคำสั่ง
dotnet ds.webapi.dll
- เจอ Error Failed to load the dll: hostfxr.dll

- มันแปลกๆ นะ ลอง list runtime ดีกว่า ด้วยคำสั่ง
dotnet --list-runtimes
- ปรากฏว่าเจอ Error ใหม่ครับ 5555
The program can’t start because api-ms-win-crt-runtime-l1-1-0.dll is missing from your computer. Try reinstalling the program to fix this problem

สาเหตุ
- เท่าที่ดูจาก keyword hostfxr.dll / api-ms-win-crt-runtime-l1-1-0.dll is missing มากจากการที่ขาดตัว Visual C++ Redistributable for Visual Studio 2015
- ปล ถ้ามี Visual C++ Redistributable for Visual Studio 2015 อยู่แล้วลอง Repair
การแก้ไข
- ติดตั้ง Visual C++ Redistributable for Visual Studio 2015
- Restart
- และลอง Start webapi ใหม่อีกรอบ
Reference
Discover more from naiwaen@DebuggingSoft
Subscribe to get the latest posts sent to your email.