且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

“CryptographicException:找不到请求的对象"当证书文件存在时

更新时间:2023-11-22 11:58:16

我遇到了类似的问题.它适用于固定文件,但不适用于与我的单元测试相关的文件.这真是令人费解,以至于我终于查看了这些文件并比较了它们的二进制文件.它们相同.它们作为字符串被读取和写入,这导致它们由于 unicode 解释而略有不同.当我自己(从资源流)将它们复制为二进制文件 (byte[]) 时,一切又恢复了.我希望这也能解决您的问题.

I had a similar problem. It worked with a fixed file but did not work with the file relative to my unit tests. This was so mindnumbling that I finally had a look at the files and compared them binary. They where not the same. They were read and written as strings, which caused them to be slightly different due to unicode interpretations. When I copied them myself (from a resourcestream) as binary (byte[]), everything worked again. I hope this solves your problem too.