ASP.NET Core 5 sqlclient not supported

Brad Gardner 21 Reputation points
2021-12-13T15:51:32.493+00:00

Hello,

First off, I'd just like to say that I am very new to ASP.NET Core so please forgive my naivety, but I am currently attempting to deploy my application to IIS only to receive a platform not supported exception for SQL Client, but am not getting the error at all when running IIS Express on the same machine. The machine that I am running it off of was Windows Server 2016 installed, and the machine that has the SQL Server (2012) is running on Windows Server R2. I'd be more than happy to provide any further information.

Thank you

Windows development Internet Information Services
SQL Server Other
0 comments No comments
{count} votes

Accepted answer
  1. Michael Taylor 60,161 Reputation points
    2021-12-13T15:59:12.63+00:00

    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.


1 additional answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2021-12-14T15:55:21.243+00:00

    As it’s a new project you should upgrade to .net 6, which has support for 3 more years, while .net 5 has less than 6 months left.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.