执行常规LINQ查询时的PlatformNotSupportedException

Joh*_*ohn 6 .net c# linq exception entity-framework-4.1

当我运行LINQ查询时,我在XP机器上得到一个奇怪的例外.

{"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)
Run Code Online (Sandbox Code Playgroud)

没有内部异常,堆栈跟踪在上面.

当密码学提供者在玩游戏等时,我会期待这种异常,但是对于LINQ,我不知道.我不得不承认我是LINQ的新手.

这是EF 4.1中稍微简化的LINQ查询:

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

任何见解?

编辑:正如下面的评论部分已经提到的,我使用.NET 4.0和EF 4.1,连接字符串是一个普通的'app.config字符串,没有应用crpto设置或其他连接字符串选项.

Jon*_*eet 4

我强烈怀疑这是试图与数据库对话所使用的安全性 - 检查您的连接字符串以及与加密连接字符串本身有关的任何选项。