About a week ago, Scott Hanselman posted a neat tip on deploying multiple /bin folders in an ASP.NET application. What's really cool about this is that it lets you build a pseudo plugin architecture into your existing ASP.NET website.
Scott documents it perfectly; I'm here to tell you that I tried it, and it works. In my case the folder structure was like so:
As you can see, I added a pre-compiled utility WebFileManager to the existing Linktron5000 website by dropping it into a subfolder, binaries and all. To get this to work, all I had to do was make one small change to the parent app Web.config:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="WebFileManager/bin" />
</assemblyBinding>
</runtime>
This sets up the probing path for the child assemblies. If you don't do this, you'll get "Assembly not found" exceptions. You also have to make a slight modification to the child .aspx page header, but this modification is safe to make in the original source file and can be permanent:
<%@ Assembly Name="WebFileManager" %>
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="WebFileManager.aspx.vb" Inherits="WebFileManager.WebFileManager"%>
Note that I didn't need the additional namespace page directive because this assembly has no namespace. Great tip, Scott. Recommended!
Hi Jeff, This solution is just what I have been searching for, except... I get the following error:
Parser Error Message: Access is denied: 'adminorders'.
Source Error:
Line 1: %@ Assembly Name="adminorders" %
Line 2: %@ Page Language="vb" AutoEventWireup="false" Codebehind="test.aspx.vb" Inherits="adminorders.test"%
Line 3: !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
Source File: c:\inetpub\wwwroot\cdms\adminorders\test.aspx Line: 1
Assembly Load Trace: The following information can be helpful to determine why the assembly 'adminorders' could not be loaded.
=== Pre-bind state information ===
LOG: DisplayName = adminorders
(Partial)
LOG: Appbase = file:///c:/inetpub/wwwroot/cdms
LOG: Initial PrivatePath = bin
Calling assembly : (Unknown).
===
LOG: Private path hint found in configuration file: adminorders/bin.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: adminorders
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/cdms/6df13855/8934a667/adminorders.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/cdms/6df13855/8934a667/adminorders/adminorders.DLL.
LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/cdms/bin/adminorders.DLL.
LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/cdms/bin/adminorders/adminorders.DLL.
LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/cdms/adminorders/bin/adminorders.DLL.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: adminorders, Version=1.0.2007.25378, Culture=neutral, PublicKeyToken=null
I have seached for ways to solve this and have had no luck. I am on Windowx XP so folder permissions shounldn't really affect this.
Do you have any suggestions to help me get this to work?
Ta
Clive.
It's the Index Service:
a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;329065"http://support.microsoft.com/default.aspx?scid=kb;en-us;329065/a
Jan Wurl on August 15, 2005 7:30 AMOh man. Thanks. Same problem. Never would have guessed the indexing service was the problem. Was driving me out of my head.
Chris on April 29, 2006 12:01 PMASP.Net - "LOG: Policy not being applied to reference at this time"
Potential Causes/Solutions for this issue I've seen online:
* web server runs out of space -- free up disk space
* aspnet worker process is messed up -- kill aspnet worker process (development environment obviously)
* Indexing Service is running (and locking files) -- disable it
* assemblies are in bin that aren't supposed to be (ref), and the machine.config has an add assembly="*" (all) -- remove unreferenced/unnecessary DLLs from the bin folder.
The last bullet is what I ran into - I removed the DLLs (named "Copy of dllNameHere.dll") from the bin folder and voila! my web service worked. I never saw this fix anywhere, so I'm posting it. Hope it helps.
Matthew Hughes
Systems Developer, MCSD
Program Director, LANUG
http://www.loweraldotnet.org
Mat, the last one fixed the problem for me. I deleted all the dlls from the bin, and then readded them and everything worked. Thanks.
Patrick Santry on August 7, 2006 9:06 AMFor me it turned out to be Avira AntiVir. Removing it seems to have fixed the problem. I'll stick with AVG.
Nick on November 29, 2006 5:42 AMman, i can't believe it: deactivating AntiVir Guard really solved it.
LoneRanger1000 on December 12, 2006 12:51 PMSame idea without having to modify any file beyond the root web.config:
runtime
assemblyBinding xmlns=urn:schemas-microsoft-com:asm.v1
probing privatePath=WebFileManager\bin /
/assemblyBinding
dependentAssembly
assemblyIdentity name=WebFileManager /
/dependentAssembly
/runtime
I had the same issue, tried everything suggested on this page and nothing helped.
What did the trick for me is to give ASPNET user full rights to the windows/temp directory.
Go20 on September 30, 2008 11:22 AMI had the same problem, but i've solved it... thanks a lot!!
Quito, Ecuador
averdesoto on February 18, 2009 8:14 AMI'm confused: why not simply create a virtual directory/application within that website (at IIS) instead? That's a one-time setup also. Why mess with web.config changes and changes in that third-party's aspx files (isn't that riskier)?
If this was about development setup within Visual Studio, there are other ways to keep both web projects running without having one a child of another in the VS solution tree, while still having them accessed with the same URLs as if one IS a child of another.
Leaving confused...
John Doe on April 28, 2011 12:45 PMThe comments to this entry are closed.
|
|
Traffic Stats |