3

我有一个 ASP.NET Web 应用程序,它有 3 个项目来处理应用程序的 3 个不同层(UI、BL 和数据访问)。当我发布 UI 项目时,将在解决方案中创建一个名为 Precompiled 的目录,并且文件将在那里可用。该文件夹将有一个 BIN 目录,其中包含所需的 DLL(引用的 DLL 和业务层项目的 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 文件夹中

4

2 回答 2

1

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.

  • c:\sites\website1
  • c:\sites\website2
  • c:\sites\website3
  • c:\sites\website4

and in IIS

  • Master Web Site
  • Web1

  • Web2

  • Web3

  • Web4

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.

于 2009-07-27T10:32:01.720 回答
0

从您创建的网站项目中添加对 BL 和 DAL 项目的引用

于 2009-07-27T10:27:42.230 回答