简体   繁体   English

如何访问ASP.NET MVC项目的bin文件夹中的DLL?

[英]How to access DLL in bin folder of ASP.NET MVC project?

I am trying to use the following to access a DLL in the project's bin folder: 我正在尝试使用以下内容访问项目的bin文件夹中的DLL:

    [HttpPost]
    public ActionResult EncryptFile()
            {
                Assembly SampleAssembly;


                var dllFile = new FileInfo(@".\\bin\\encrypt.dll");
                 SampleAssembly = Assembly.LoadFile(dllFile.FullName);
    //...trimmed...
}

I also attempted var dllFile = new FileInfo(@"\\\\bin\\\\encrypt.dll"); 我还尝试了var dllFile = new FileInfo(@"\\\\bin\\\\encrypt.dll"); (note lack of . before the filepath), but it did not work either. (请注意,在文件路径前缺少. ),但是它也不起作用。 In the debugger, the FullName returns \\\\\\\\bin\\\\encrypt.dll in this second case. 在第二种情况下,在调试器中, FullName返回\\\\\\\\bin\\\\encrypt.dll

What can I do to make it locate the file? 我该怎么做才能找到文件?

Thank you. 谢谢。

Assembly SampleAssembly = Assembly.LoadFile(Server.MapPath(@"~/bin/encrypt.dll"));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法加载文件或程序集 - 类库中的 dll 未复制到 asp.net 项目 bin 文件夹 - Could not load file or assembly - dll from class library is not copied over to asp.net project bin folder ASP.NET MVC5 访问项目外的文件夹 - ASP.NET MVC5 access folder outside project ASP.NET从bin文件夹加载非托管dll - ASP.NET Load unmanaged dll from bin folder 如何在MVC 4.0 ASP.NET中从项目外部访问网络中的文件夹? - How to access folder in network which outside from project in MVC 4.0 ASP.NET? 如何将第三方dll从bin文件夹移动到ASP.NET Web Forms项目中的另一个文件夹? - How to move third party dlls from bin folder to another folder in ASP.NET Web Forms project? 如何通过ASP.NET MVC访问Program Files文件夹 - How to access Program Files folder via ASP.NET MVC 如何在ASP.NET MVC项目中访问LocalDB - How to access LocalDB in asp.net mvc project asp.net:在asp.net MVC中将dll放入Bin文件夹中是否可以工作? - asp.net: Should dropping dlls into the Bin folder work in asp.net MVC? 与DLL相关的DLL的bin文件夹错误与asp.net中的obj文件夹有关 - error in bin folder related to DLL conected with obj folder in asp.net 将DLL控制器添加到ASP.NET MVC项目 - Add DLL controller to ASP.NET MVC project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM