gpt4 book ai didi

c# - 执行一般 LINQ 查询时出现 PlatformNotSupportedException

转载 作者:太空狗 更新时间:2023-10-29 21:46:42 26 4
gpt4 key购买 nike

当我运行 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)

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

当密码学提供者在玩等时,我希望出现这种异常,但对于 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;
}

有什么见解吗?

编辑:正如在下面的评论部分中已经指出的那样,我将 .NET 4.0 与 EF 4.1 结合使用,连接字符串是一个普通的 ol' app.config 字符串,没有应用任何 crpto 设置或其他连接字符串选项。

最佳答案

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

关于c# - 执行一般 LINQ 查询时出现 PlatformNotSupportedException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7281896/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com