The request was aborted: Could not create SSL/TLS secure channel.

resident

Active member
Joined
May 8, 2023
Messages
25
Programming Experience
5-10
Hello . Good time
I wrote a software with .NET MVC (C#) targeting .NET Framework 4.8.1.
In the project, I installed the package "TaxCollectData.Library" from nugget and wrote the following code in the program.

11:
TaxApiService.Instance.Init(MEMORY_ID,
            new SignatoryConfig(PRIVATE_KEY, null),
            new NormalProperties(ClientType.SELF_TSP), "https://sandboxrc.tax.gov.ir/req/api/");

TaxApiService.Instance.TaxApis.GetServerInformation();

It gives an error when running:
The request was aborted: Could not create SSL/TLS secure channel.

I created a new project with the same specifications as above and added the package to it, but the written code works without errors.

I don't know why it gives this error on the old project that I added?

photo.jpg
 
Are you sure your old project is really compiled for .NET Framework 4.8.1? Older versions of the .NET Framework defaulted to a now obsolete version of TLS. You could override the old default as one the very first operations in your Main(), but you might as well do the right thing for the long term and actually use .NET Framework 4.8.1 so that you don't need to explicitly set the TLS version.
 
Back
Top Bottom