SQL Server encryption using a self-signed SSL certificate. Request from ASP.NET 3.5

I created a self-signed certificate to test encryption between my web application and SQL Server.

When trying to query the database using "Encrypt = Yes;" in the connection string, I get the following message:

The connection to the server was successfully established, but then an error occurred while establishing a connection with the preliminary connection. (provider: SSL provider, error: 0 - the certificate chain was issued by a trusted authority.)

Background
I received an identical message the first time I tried an encrypted connection from the management studio. This was resolved by installing a self-signed certificate in my trusted certification authorities.

Question
Is there a way to force ASP.NET to trust the certificate in the same way as my user account?

+3
source share
2 answers

OK, the correct answer for this question is to add a self-signed certificate to the certificate store.

Incorrect path.
Installing the certificate by double-clicking on the .cer file on the server
 - This adds the certificate only to the registered user, therefore, in some cases, the operation personified.


CertMgr.exe .
 - CertMgr.exe SDK Windows , -, bin Visual Studio 2005. VS2008.
 - CertMgr.exe .  - CertMgr.exe, trustedpublishers localmachine, :
 - certmgr /add Your.Certificate.Filename.cer /s /r localmachine root
 - certmgr /add Your.Certificate.Filename.cer /s /r localmachine trustedpublisher

, . (/add *.cer .)

+3

: <identity impersonate="true"/> ( system.web web.config)

, , , ASP.NET , , .

. , .

0

Source: https://habr.com/ru/post/1724364/


All Articles