C#文件可见性 [英] C# file visibility

查看:88
本文介绍了C#文件可见性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用C#编写一个使用CngProvider类的.NET应用程序,但由于某种原因它无法加载所需的DLL.

我不想使用Microsoft CngProvider实现,而是想使用已经在系统上配置的智能卡提供程序.

当底层的CNG实现尝试从System32文件夹中加载提供程序DLL时,它会收到找不到提供程序DLL"异常.

该DLL绝对存在于System32文件夹中,并且Microsoft证书服务无问题地使用了该DLL.

奇怪的是,我制作了一个简短的C#应用​​程序,该应用程序遍历System32文件夹中的文件列表,尽管我已经设置了文件权限以允许对SYSTEM/Everyone进行完全控制,但它没有看到DLL.

我还使用模拟来以管理员身份运行该应用程序,但仍然看不到我需要的DLL.

有人有建议吗?

* UPDATE *,建议将DLL放在其他位置的用户:
我的应用程序不是加载DLL的应用程序.MicrosoftCNG系统是加载DLL的组件.对于非.NET应用程序可以正常工作,但是由于某些原因,当.NET请求CNG访问提供程序时,它不可见.

I''m writing a .NET application in C# which uses the CngProvider class but it cannot load a required DLL for some reason.

I don''t want to use the Microsoft CngProvider implementation and would like to use a smart card provider which is already configured on my system.

When the underlying CNG implementation attempts to load the provider DLL from the System32 folder it gets a "Provider DLL could not be found" exception.

The DLL is most definitely present in the System32 folder and is used without issue by Microsoft Certificate Services.

Curiously I made a short C# application which iterates over the list of files in the System32 folder and it does not see the DLL despite the fact that I''ve set the permissions on the file to allow full control for SYSTEM / Everyone.

I also used Impersonation to run the application as the Administrator and am still unable to see the DLL I need.

Does anyone have a suggestion?

*UPDATE* for those who would suggest to put the DLL somewhere else:
My application will not be the one loading the DLL The microsoft CNG system is the component that loads the DLL. Works fine for non-.NET applications but for some reason it is not visible when .NET is asking CNG to access the provider.

推荐答案

请尝试将DLL放入您的项目文件夹放在某个位置,然后从那里添加对它的引用.不能保证它能正常工作.
Try putting the DLL into your project folder somewhere and then adding a reference to it from there. No guarantees it''ll work though.


这篇关于C#文件可见性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆