简体   繁体   English

下载ASP.Net App的bin文件夹的dll文件

[英]Downloading bin folder's dll file of ASP.Net App

我只想知道,是否可以从生产服务器的bin目录下载我的应用程序的dll文件...

Not via HTTP, if that's what you mean. 如果那是您的意思,请不要通过HTTP。 You don't generally want to make that file available in that way. 您通常不希望以这种方式使该文件可用。

If for some reason you want to make it available, like in some kind of code sharing scenario, I would code up a page that streams it out directly: 如果出于某种原因(例如在某种代码共享方案中)要使其可用,我将编写一个页面直接将其流式输出:

var fullQualifiedPathToDll = Server.MapPath("/") + "/bin/mydll.dll";

var myFileStream = new FileStream(fullQualifiedPathToDll, FileMode.Open);
var fileSize = myFileStream.Length;

var buffer = new byte[(int)FileSize];
myFileStream.Read(buffer, 0, (int)FileSize);
myFileStream.Close();

Response.BinaryWrite(buffer);

Be VERY sure that this is what you want to do when you're doing it. 非常确定这是您要执行的操作。 This is adapted from a sample found here . 这是从此处找到的样本改编而成。

Under normal circumstances, no. 在正常情况下,不会。 ASP.NET blocks requests to the bin directory. ASP.NET阻止对bin目录的请求。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM