R – Can’t access bin folder assemblies from virtual directory under site in a ASP.NET deployment

asp.netiisvirtualvirtual-directory

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

Best Answer

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.

Related Topic