PlatformNotSupportedException when executing a generic LINQ query

I get a strange exception on an XP machine when I run a LINQ query.

{"The specified cryptographic algorithm is not supported on this platform."} at System.Security.Cryptography.CapiNative.AcquireCsp(String keyContainer, String providerName, ProviderType providerType, CryptAcquireContextFlags flags, Boolean throwPlatformException) 

There is no internal exception, and stacktrace is higher.

I would expect such an exception when cryptography providers played, etc., but with LINQ I have no idea. I have to admit I'm new to LINQ.

Here's a slightly simplified LINQ query in EF 4.1:

 using (var c = new MyContext()) { var v = (from item in c.Items where (item.ID==someid) select item).FirstOrDefault(); return v; } 

Any insight?

EDIT: As noted in the comments section below, I am using .NET 4.0 with EF 4.1, the connection string is a simple β€œapp.config” line without crpto settings or other connection string parameters.

+6
source share
1 answer

I strongly suspect that the security used is trying to talk to the database - check your connection string and any parameters that you have for encrypting the connection string itself.

+4
source

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


All Articles