无法从 ASP.NET 部署中站点下的虚拟目录访问 bin 文件夹程序集
我有一个 ASP.NET Web 应用程序,它有 3 个项目来处理应用程序的 3 个不同层(UI、BL 和数据访问)。 当我发布 UI 项目时,将在解决方案中创建一个名为 Precompiled 的目录,并且文件将在该目录中可用。 该文件夹将有一个 BIN 目录,其中也包含所需的 DLL(引用的 DLL 以及 Business Layer 项目的 DLL 和 DataAccessLayer 项目的 DLL)。
这很好用。 现在我想使用相同的 BL 和 DataAcess 层来运行多个 UI(网站)。 我想要一个名为 WebsiteA、WebSiteB、MyWebSite1、ShyjusWeb 等的网站。我想为其中每一个创建虚拟目录。 因此,我创建了一个网站,并在该网站下为上述网站创建了虚拟目录。 我将 index.asp (我的解决方案中的 UI 项目的)放在映射到一个虚拟目录的文件夹中,当尝试访问时,我收到如下错误:
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load the assembly 'App_Web_lls0_qzf'. Make sure that it is compiled before accessing the page.
Source Error:
Line 1: <%@ page language="C#" autoeventwireup="true" inherits="index, App_Web_lls0_qzf" %>
Line 2: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Line 3: <html xmlns="http://www.w3.org/1999/xhtml">
Source File: /websiteA/index.aspx Line: 1
似乎页面无法从 BIN 文件夹访问所需的 DLL。 有什么办法可以解决这个问题吗? 我正在玩IIS 6.0。 我的文件夹层次结构现在是这样的:
根文件夹 - > Bin文件夹,各种UI相关文件& 文件夹 现在已转换为虚拟目录的文件夹 (WebSiteA)。 在 WebSiteA 中,我有 inde.aspx,它与根文件夹中可用的 index.aspx 的副本相同。
我需要有相同的网站(复制每个网站仅进行一些 CSS 更改)。 如果我从根目录复制 Bin 文件夹并将其与 index.aspx 一起粘贴到每个虚拟目录文件夹中,则它可以正常工作。 但我不想每个站点都有相同的 BIN 文件夹。 我只想有一个BIN,它应该位于ROOT文件夹中
I have an ASP.NET web application which has 3 projects to handle 3 different layers of the application (UI , BL and Data Access). When I publish the UI project a directory called Precompiled will be created in the solution and files will be available there. This folder will have a BIN directory which holds required DLLs (referenced DLLs and DLL of Business Layer project & DLL of DataAccessLayer Project) too.
This works fine. Now I want to use the same BL and DataAcess layer to run multiple UIs (websites). I want to have website called WebsiteA, WebSiteB, MyWebSite1, ShyjusWeb etc. I want to create virtual directory for each one of these. So I created a website and under that i created Virtual directories for the above sites. I put index.asp (of the UI project I had in my solution) in the Folder which is mapping to one virtual directory and when trying to access, I am getting an error like the following:
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load the assembly 'App_Web_lls0_qzf'. Make sure that it is compiled before accessing the page.
Source Error:
Line 1: <%@ page language="C#" autoeventwireup="true" inherits="index, App_Web_lls0_qzf" %>
Line 2: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Line 3: <html xmlns="http://www.w3.org/1999/xhtml">
Source File: /websiteA/index.aspx Line: 1
It seems like the page is not able to access the required DLL's from the BIN folder. Is there any way to solve this? IIS 6.0 I am playing with. My folder hierarchy is like this now:
Root Folder - > Bin folder, Various UI related files & folders a folder which is converted to a virtual directory now (WebSiteA). Inside WebSiteA, I have inde.aspx, which is the same copy as of the index.aspx available in the root folder.
I need to have the same website (copy with only some CSS changes for each site). If I copy the Bin folder from my root and paste it in each of the virtual directory folders along with the index.aspx, it's working. But I don't want to have same BIN folder for each sites. I want to have only one BIN, which should be in the ROOT folder
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为你已经陷入了困境。
您提到的文件(App_Web_lls0_qzf)似乎是第一个指定的 UI/BL/DAL 组合的编译 DLL,不幸的是,我对您的文件夹结构的描述感到困惑。
我不清楚您是否想要同一站点的多个副本,或者每个站点是否不同。
您是否没有尝试过创建4个网站,并引用常见的BL和DAL项目?
请记住,您的文件结构和 IIS 结构不必相同,即
和 IIS
Web2
Web3
Web4
记住继承! - 您的主网站中的 DLL 和引用将继承到您的虚拟目录中。 您可能还希望考虑为每个网站创建网络应用程序池。
I think you have gotten yourself in a muddle.
The file you mention (App_Web_lls0_qzf) appears to be the compiled DLL for the first specified UI/BL/DAL combination and I am unfortunately confused by your description of your folder structure.
I am not clear about whether you are wanting multiple COPIES of the same site or whether each site is different.
Have you not tried creating the 4 websites, and referencing the the common BL and DAL projects?
Remember that your file structure and your IIS structure do not have to be the same, i.e.
and in IIS
Remember inheritance! - DLLs and references in your master website will be inherited into your virtual directories. You may also wish to consider creating web app pools for each web site.
从您创建的网站项目添加对 BL 和 DAL 项目的引用
Add a reference to your BL and DAL projects from the website project that you created