简体   繁体   中英

Can't connect to SQL Server database from Local IIS over HTTPS

I'm working on an application using ASP.NET MVC5 and connecting to my SQL Server database with SqlClient (Dapper.NET)

I've been using Local IIS without a problem on http://localhost:port/ but now I have switched over to HTTPS (self-signed key), with a binding of https://www.mysite.com and the hosts file is redirecting that URL to 127.0.0.1

The problem that I am having is the following:

A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The specified data could not be decrypted.\\r\\n)

This is happening when I am attempting to connect to my SQL Server database with the standard connection.Open() call.

I've read around about people suggesting to restart the IIS server, or to reconfigure the SQL Server database to have encryption forced off. I've checked both of these, but that doesn't resolve the problem.

Can anyone shed some light on what might be going wrong here?

I know why this is...

It's a component available via NuGet called NCrypt which I've just spent 6 hours isolating.

I'm not sure how, but when it's present in my bin folder it interferes somehow with the handshake process between the code and SQL Server.

When it's removed, voila! SQL connects as expected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM