Firstly, did you install the .NET 5 runtime onto the IIS machine and ensure that you restarted IIS so it took effect as discussed here?
When you created your IIS app pool for your application did you set the .NET CLR Version to No managed Code
? This is needed for .NET 5.
Did you configure the app pool to be x86 or x64? Check in the app pool's advanced settings in IIS for Enable 32-bit Applications
.
What is the target framework of your application (from the project file)?
As part of your deployment SqlClient requires the native SNI binaries as well. There are issues with deployments around this component so the general recommendation is to add an explicit NuGet dependency in your project (Manage Nuget Packages for Project
) on Microsoft.Data.SqlClient.SNI
.