473,769 Members | 6,305 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get ASP.NET to find DLLs in different paths

I'm sure there's an obvious way to do this, but I'm missing it so far.

I have an ASP.NET application that relies on several DLLs to work. Currently
in order to get my site working I have to put them all in the bin/ folder
within my web site's directory.

As I have numerous web sites, I want to be able to place all of these DLLs
just once into a single location elsewhere on the disk (e.g., "D:\DLLs"). I
don't want to put them into the GAC.

How can I configure my ASP.NET web sites so that they pick up the required
DLLs from the D:\DLLs directory? I have tried adding this to the web.config
file and it didn't make any difference:
<?xml version="1.0" encoding="utf-8" ?>
<configuratio n>

<runtime>
<assemblyBindin g xmlns="urn:sche mas-microsoft-com:asm.v1">
<probing privatePath="D: \DLLs" />
</assemblyBinding >
</runtime>

[...rest of web.config file...]
</configuration>
With this in place and the bin/ folder removed, the code fails:

Dim myObject As MyDLL.MyClass

Compiler Error Message: BC30002: Type 'MyDLL.MyClass' is not defined.

How can I get this working?

Many thanks,

--

(O)enone
Nov 19 '05 #1
7 3109
Make a virtual directory to your dlls
--
Staff Consultant II
Enterprise Web Services
Cardinal Solutions Group

Future Business Model
Loan Origination Services
National City Mortgage
"Oenone" wrote:
I'm sure there's an obvious way to do this, but I'm missing it so far.

I have an ASP.NET application that relies on several DLLs to work. Currently
in order to get my site working I have to put them all in the bin/ folder
within my web site's directory.

As I have numerous web sites, I want to be able to place all of these DLLs
just once into a single location elsewhere on the disk (e.g., "D:\DLLs"). I
don't want to put them into the GAC.

How can I configure my ASP.NET web sites so that they pick up the required
DLLs from the D:\DLLs directory? I have tried adding this to the web.config
file and it didn't make any difference:
<?xml version="1.0" encoding="utf-8" ?>
<configuratio n>

<runtime>
<assemblyBindin g xmlns="urn:sche mas-microsoft-com:asm.v1">
<probing privatePath="D: \DLLs" />
</assemblyBinding >
</runtime>

[...rest of web.config file...]
</configuration>
With this in place and the bin/ folder removed, the code fails:

Dim myObject As MyDLL.MyClass

Compiler Error Message: BC30002: Type 'MyDLL.MyClass' is not defined.

How can I get this working?

Many thanks,

--

(O)enone

Nov 19 '05 #2
Michael Baltic wrote:
Make a virtual directory to your dlls


Thanks for the suggestion. I assume you mean to do this in the IIS
management window?

I created a virtual directory inside my web site's own directory, calling
the new directory 'bin' and pointing it to the physical location on disk
where my DLLs are located. This still didn't make any difference -- it still
reported that the referenced class was not defined.

Do I need to do anything else to make this work?

Thanks,

--

(O)enone
Nov 19 '05 #3
Michael:

A vdir would only work if the assembly loader knew about virtual
directories, but it doesn't.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Fri, 8 Jul 2005 08:43:09 -0700, "Michael Baltic"
<Mi***********@ discussions.mic rosoft.com> wrote:
Make a virtual directory to your dlls


Nov 19 '05 #4
Hi Oenone:

A privatePath has to be private - in a subfolder of the application.

I think you are looking for all the pain of being in the GAC (for
instance, your apps won't shadow copy the assemblies - you'll have to
shut all the web apps down to upgrade) without any of the benefits
(for instance, versioning). It's the road to the old "dll-hell".

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Fri, 8 Jul 2005 13:45:07 +0100, "Oenone" <oe****@nowhere .com>
wrote:
I'm sure there's an obvious way to do this, but I'm missing it so far.

I have an ASP.NET application that relies on several DLLs to work. Currently
in order to get my site working I have to put them all in the bin/ folder
within my web site's directory.

As I have numerous web sites, I want to be able to place all of these DLLs
just once into a single location elsewhere on the disk (e.g., "D:\DLLs"). I
don't want to put them into the GAC.

How can I configure my ASP.NET web sites so that they pick up the required
DLLs from the D:\DLLs directory? I have tried adding this to the web.config
file and it didn't make any difference:
<?xml version="1.0" encoding="utf-8" ?>
<configuration >

<runtime>
<assemblyBindin g xmlns="urn:sche mas-microsoft-com:asm.v1">
<probing privatePath="D: \DLLs" />
</assemblyBinding >
</runtime>

[...rest of web.config file...]
</configuration>
With this in place and the bin/ folder removed, the code fails:

Dim myObject As MyDLL.MyClass

Compiler Error Message: BC30002: Type 'MyDLL.MyClass' is not defined.

How can I get this working?

Many thanks,


Nov 19 '05 #5
Scott Allen wrote:
A privatePath has to be private - in a subfolder of the application.
Ah, so that explains why that didn't work then!
I think you are looking for all the pain of being in the GAC (for
instance, your apps won't shadow copy the assemblies - you'll have to
shut all the web apps down to upgrade) without any of the benefits
(for instance, versioning). It's the road to the old "dll-hell".


Hmm... I'm really genuinely surprised that there is no option to pick up
DLLs from a location outside the web app directory. I thought my planned
work for today would be trivial but it turned out to be a bit of a
nightmare. :-)

So what are the recommended courses of action to resolve this? It seems to
me that these are my options:

A. Copy all the required DLLs to each web application's private bin/
directory.

B. Copy all the required DLLs to the GAC.

The disadvantages of these to me are:

A. The apps use about 20 different DLLs, and we have in excess of 30
different applications on our web servers (which are mirrored across
multiple machines just to make it evern more interesting). Putting private
copies of DLLs into bin/ directories will result in about 600 DLLs per
server! That's an awful lot to manage, especially when we need to upgrade
one of those DLLs across all of the applications.

B. The GAC might be better, but we use an automated application that checks
all DLLs on our server are present in the correct locations on disk, and are
the correct versions (these are all matched up to corresponding DLLs in a
SourceSafe database). I don't think I'd be able to use this application if
we deploy to the GAC.

A couple of other questions if you'd be so kind:

Shadowing is a feature that I'm particularly interested in being able to
use. Does shadowing not work if we deploy to the GAC? Or would copying an
updated DLL (with a new version number) simply cause the two versions of the
DLL to both be present in the GAC at the same time?

I'm also slightly concerned about putting DLLs inside a folder that is
potentially accessible via a web site. Does IIS/ASP.NET have any security
features that stops people from downloading my DLLs by accessing them
straight from the bin/ directory?

Many many thanks for your help!

--

(O) e n o n e
Nov 19 '05 #6
Hello, Oenone:
<snip>

Hmm... I'm really genuinely surprised that there is no option to pick up
DLLs from a location outside the web app directory. I thought my planned
work for today would be trivial but it turned out to be a bit of a
nightmare. :-)

There is a <codebase> hint you can use in <assemblyBindin g> also - but
you'll need strong named assemblies. For the codebase href use
"file:///". There is also an AssemblyResolve event on an AppDomain
object, see:
http://blogs.msdn.com/junfeng/archiv...16/258081.aspx.
Jenfeng's blog has a lot of good notes on the assembly loader.
So what are the recommended courses of action to resolve this? It seems to
me that these are my options:

A. Copy all the required DLLs to each web application's private bin/
directory.

B. Copy all the required DLLs to the GAC.

The disadvantages of these to me are:

A. The apps use about 20 different DLLs, and we have in excess of 30
different applications on our web servers (which are mirrored across
multiple machines just to make it evern more interesting). Putting private
copies of DLLs into bin/ directories will result in about 600 DLLs per
server! That's an awful lot to manage, especially when we need to upgrade
one of those DLLs across all of the applications.

True, that is a lot of files to manage. Could you write an
installation script that looks for the dll in subfolders of a well
known root location?

I think you face some tough tradeoffs and it's hard to make a
recommendation without knowing your build, test, deployment process
and a bit about the applications. Personally, I'm more at ease with a
private deployment to the bin simply because each application can be
an island unto itself - it doesn't need to upgrade when another app
upgrades and remains self contained. That's what works in my
environment.
B. The GAC might be better, but we use an automated application that checks
all DLLs on our server are present in the correct locations on disk, and are
the correct versions (these are all matched up to corresponding DLLs in a
SourceSafe database). I don't think I'd be able to use this application if
we deploy to the GAC.

The GAC does indeed come with it's own set of headaches...inc luding an
undocumented API.
A couple of other questions if you'd be so kind:

Shadowing is a feature that I'm particularly interested in being able to
use. Does shadowing not work if we deploy to the GAC? Or would copying an
updated DLL (with a new version number) simply cause the two versions of the
DLL to both be present in the GAC at the same time?

Shadow copying does not work for strong named assemblies, so it won't
work for GAC'ed assemblies. In addition, the ASP.NET runtime
configures itself to only shadow copy from the bin subdirectory.

You can have side by side versions of an assembly in the GAC at the
same time - that is one of the GAC's selling points.
I'm also slightly concerned about putting DLLs inside a folder that is
potentially accessible via a web site. Does IIS/ASP.NET have any security
features that stops people from downloading my DLLs by accessing them
straight from the bin/ directory?


Yes - on IIS 6.0 the ASP.NET ISAPI filter blocks the request and
returns a 404 for any content in /bin (even an .html file).

I hope I provided some information you can use.

--
Scott
http://www.OdeToCode.com/blogs/scott/

Nov 19 '05 #7
Scott Allen wrote:
[...]
I hope I provided some information you can use.


You certainly have Scott, I'll be sitting down on Monday to work out which
is the best of the options available.

Many thanks for your help,

--

(O) e n o n e
Nov 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3392
by: bissatch | last post by:
Hi, I have just finishing installing apache and PHP4. It is claiming that it cannot find the php_domxml.dll file giving me the following error when I go to load a page with dom xml function on it: Unknown(): Unable to load dynamic library 'C:/php/extensions/php_domxml.dll' - The specified module could not be found
3
5893
by: SAM | last post by:
Hi everyone, I consider myself a very competent programmer when it comes to actual programming and analyzing the business that I'm modelling. I am now crossing into what I would consider Access admin/config territory, an area where I generally suck at. Here is my problem. I do all my programming on my laptop before giving
11
17021
by: PÃ¥l Eilertsen | last post by:
Hi, I have recently installed Visual Studio .Net 2003 and am trying to compile and run a simple windows form app (used the VS wizard). When trying to run I get an error message telling me: "fatal error C1083: Cannot open include file: 'stdlib.h': No such file or directory". I have browsed to C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include and have found the file there. What can be wrong? I have also tried to uninstall...
5
2070
by: Rich | last post by:
Hi there, For a quite big application, I need to get large amount of data within a static library (xxx.lib) and put them in a database (a class, say we call it CData), and then make it accessible by a few different dynamic library files (yyy.dll, …). I’ve tried to create a global class object of CData*, say pData, by declaring it as an external in the header and initiate it in the cpp of a dll file. But it doesn’t work. Other dlls...
21
2858
by: Chris Durkin | last post by:
I've got an ASP.NET website on my local box, set to compile to bin\Debug and bin\Release in debug and release modes. Both directories are populated with dlls, as the solution has been compiled in both modes. When I browse to the local website, it works, but which set of dlls is it using? What happens when I deploy to Test and there is only a \bin\ directory, no \Debug or \Release? I assume .NET has some path-searching rules that govern...
0
992
by: Ben Harper | last post by:
Is there any way one can instruct asp.net to load unmanaged dlls from a path other than one included in PATH or in System32? I have a mixed-mode C++ assembly which references a bunch of other native dlls. Right now the only way I can get asp.net to (indirectly) load them is by adding their location to my system PATH variable. Is there any cleaner way? Thanks, Ben
2
3563
by: fig000 | last post by:
Hi everyone, I recently wrote a vb.net app which includes some crystal reports. The user has very little money in their budget and have been without a working application for quite a while. This being the case I worked with what was available: I used vb.net and crystal 8.5. The crystal reports are being viewed in the crystal report viewer which is still included in vb.net. I went ahead with developing this project because I found that...
0
1255
by: Andrew Meador - ASCPA, MCSE, MCP+I, Network+, A+ | last post by:
I have Visual C# 2005 Express. I have found the ReportViewer Redistributable SP1 (full install) and installed it, but it doens't add references to C# Express so that the ReportViewer control shows up in the toolbox. I have searched all over trying to find the files to reference, but can't find them. If someone out there could please tell me in detail how to add these references (file names, paths, how in C# Express to properly add the...
3
3666
by: =?Utf-8?B?a3lvbmc=?= | last post by:
Quick question. Say I have a project against the 2.0framework. I also have a dll compiled against 3.5. If I reference the 3.5 dll in the 2.0 project, how would that work? So I'm thinking that the 3.5 dll gets loaded in memory by the 3.5 framework running in process X. The 2.0 project dlls get loaded in the process running the 2.0 framework in
0
9587
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9993
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8870
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.