ASP.NET网站的BIN目录和引用
想象一下以下解决方案:
- 网站 ABC.com(不是 Web 应用程序)
- BLL(单独程序集中的业务逻辑层)
- DTO(其自己的程序集中的 dto 对象)
DAL(也在其自己的程序集中的数据访问层)。< /p>
- BLL 引用了 DAL。
- BLL 引用了 DTO 层。
- 网站项目引用了 BLL。
编译网站工程时,BIN目录下会出现以下DLL:
BLL.dll
DTO.dll
DAL.dll
当人们去预览网站时,会发生由于没有必要的程序集引用而发生的错误...现在,如果右键单击网站项目,添加引用,并显式添加对缺少的程序集的引用,它将起作用美好的。
在我看来,ASP.NET 会提取网站中添加/引用的引用程序集的引用程序集。
为什么需要添加对引用的引用的显式引用...? 抱歉,如果我的措辞不正确或者令人困惑。
Imagine the following solution:
- Website ABC.com (not Web Application)
- BLL (business logic layer in a seperate assembly)
- DTO (dto objects in their own assembly)
DAL (data access layer in it's own assembly as well).
- The BLL has a reference to the DAL.
- The BLL has a reference to the DTO layer.
- The Website project references the BLL.
When one compiles the website project, the following DLLs will appear in the BIN directory:
BLL.dll
DTO.dll
DAL.dll
When one goes to preview the site, an error occurs about not having the necessary assembly references... Now if one right clicks on the website project, Add Reference, and explicitly add the reference to the missing assemblies, it will work fine.
It seems to me like ASP.NET pulls the referenced assemblies of the referenced assembly being added/referenced in the website.
Why does one need to add explicit references to the references of the references... ? Sorry if I'm not wording this correctly or if it confusing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为问题可能与使用网站项目(而不是 Web 应用程序)有关。 我一时记不清了,但与 Web 应用程序项目相反,网站项目的编译方式有些奇怪。
I think the problem may have to do with using a web site project, as oppossed to a Web Application. I can't remember off the top of my head, but there's something funky about the way web site projects are compiled, as oppossed to web application projects.
这是关于您的问题编译和部署的好文章。
它与运行时编译的“WebSites”有关。 希望以上文章能够解答您的问题。
Here is a good article on your question Compilation and Deployment.
It has something to do with "WebSites" being compile at runtime. Hopefully the above article will answer your question.
今天刚刚为我正在进行的项目测试了这个场景。 您只需将程序集添加到 Web.config 中即可,如下所示:
此外,您的程序集应保留在网站根目录下著名的 ./bin 文件夹中。
GL!
Just tested this scenario today for the project I'm on. You should be just fine just adding your assembly in Web.config as:
Also your assemblies should stay in the famous ./bin folder of your web site's root.
GL!