473,721 Members | 2,255 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Loading assemblies from database in an ASP.NET application

BlankHi,
I am having trouble loading assemblies from the database in my ASP.NET app.

I have a default.aspx in my app that is served from a database via a custom virtual path provider. This works fine, until this
default.aspx uses code in a dependent assembly (say CustomAssembly) . Then ASP.NET cannot find the class "CustomAssembly .MyClass" and files
to compile the default.aspx.

I've tried to do a

AppDomain.Curre ntDomain.Load(b yte[] rawAssembly)

up front (prior to default.aspx compilation) to help ASP.NET to find this class, but the ASP.NET runtime looks to ignore it. However, I can successfully do

AppDomain.Curre ntDomain.Create Instance("Custo mAssembly, Version=1.0.0.0 , Culture=neutral , PublicKeyToken= null", "CustomAssembly .MyClass");

Also, I can verify that the "CustomAssembly " is actually loaded by looking at the value of AppDomain.Curre ntDomain.GetAss emblies().
The custom assembly i loaded from database is included there, get its codebase set to something like file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary%20ASP .NET%20Files/root/300b5c74/97825cbb/assembly/dl3/95cc4ab5/aa815946_b9bac8 01/AppWeb.DLL

Why does ASP.NET ignore the existence of classes that are actually loaded into the runtime and are accessible through reflection?
Any suggestions on the next steps to achieve the dynamical loading I am seeking?
(I need to create a sort of host application to which modules can be plugged/deployed in at runtime)

-Tor
Jun 27 '08 #1
1 2239
to compile a page, the compiler needs read access to dll also so it can
resolve symbols and method signatures. also the asp.net compiler has limited
path search capabilities. in the case of non-gac assemblies, they must be in
the bin folder.

you could have the pages load the assemblies at runtime, and a set of
interfaces may make this practical. i've done this before - loading the
assembly from the database, and calling a known iteface (and sometimes used
reflection).

you could also do what asp.net does. create a temp folder, copy the page
source and database dlls to the temp folder. compile the page (can use the
aspnet_compiler ), then load the compiled page assembly from the temp folder.
(be sure to load the database dll once). this is probably the approach you
want to do if the pages can not be precompiled.

-- bruce (sqlwork.com)
-- bruce (sqlwork.com)
"Tor BÃ¥dshaug" wrote:
BlankHi,
I am having trouble loading assemblies from the database in my ASP.NET app.

I have a default.aspx in my app that is served from a database via a custom virtual path provider. This works fine, until this
default.aspx uses code in a dependent assembly (say CustomAssembly) . Then ASP.NET cannot find the class "CustomAssembly .MyClass" and files
to compile the default.aspx.

I've tried to do a

AppDomain.Curre ntDomain.Load(b yte[] rawAssembly)

up front (prior to default.aspx compilation) to help ASP.NET to find this class, but the ASP.NET runtime looks to ignore it. However, I can successfully do

AppDomain.Curre ntDomain.Create Instance("Custo mAssembly, Version=1.0.0.0 , Culture=neutral , PublicKeyToken= null", "CustomAssembly .MyClass");

Also, I can verify that the "CustomAssembly " is actually loaded by looking at the value of AppDomain.Curre ntDomain.GetAss emblies().
The custom assembly i loaded from database is included there, get its codebase set to something like file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary%20ASP .NET%20Files/root/300b5c74/97825cbb/assembly/dl3/95cc4ab5/aa815946_b9bac8 01/AppWeb.DLL

Why does ASP.NET ignore the existence of classes that are actually loaded into the runtime and are accessible through reflection?
Any suggestions on the next steps to achieve the dynamical loading I am seeking?
(I need to create a sort of host application to which modules can be plugged/deployed in at runtime)

-Tor

Jun 27 '08 #2

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

Similar topics

2
3128
by: Foehammer | last post by:
Hello, I'm trying to load an assembly dynamically using an app domain. This is a proof-of-concept for a larger project, so please excuse the lame class names. TestLib is the dll where all the dynamic loading code will go. The assemblies being dynamically loaded do not contain any code. They are resource-only assemblies. I have succeeded in dynamically loading them within the same AppDomain as the main application (a Winforms EXE that...
3
2496
by: RickN | last post by:
We have a C# remoting application that runs thru the web. Assemblies appear to be loaded from the download cache. Is there any way to have them automatically copied to the GAC and be loaded from there: for performance reasons and to be applicable machine wide. We'd also like to be able to use an installation package to pre-load all the dll's and don't see how an installation program can pre-loaded them into the download cache. Thanks,...
9
4487
by: Ender | last post by:
I have an application that I would like third party developers to be able to create Plug-ins that will be dynamically loaded into our application to extend functionality. I have utilized the "Let Users Add Functionality to Your .NET Applications with Macros and Plug-Ins" article at MSDN for the dynamic loading of DLLs http://msdn.microsoft.com/msdnmag/issues/03/10/Plug-Ins/default.aspx
6
4503
by: Pete Davis | last post by:
I'm confused about what precisely the limitations are on loading plugins in separate app domains. In all my previous apps that supported plugins, I've loaded them into the same domain as the app, but I've just started playing around with separate AppDomains and I'm finding that I'm not having problems where I expected I would, so maybe someone can help me understand a bit better. I've read that objects instantiated in separate AppDomains...
7
10962
by: R Reyes | last post by:
Can someone please explain to me why I can't get the MS Word Interop assembly to work in my VS2005 project? I'm trying to manipulate MS Word from my Web Form application and I can't get passed this screen below. Please help, thanks in advance... Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify...
0
2316
by: npthomson | last post by:
Hi all, This could get a bit complicated but I'll try to be as clear as possible. I've written an application that discovers plugins at runtime using reflection from a subdirectory of the application, eg: In the directory the application is installed to: \application.exe \plugins\plugin1.dll
2
1850
by: wzhao2000 | last post by:
Back in COM time, it's possible to use #import statement in cpp to load COM object type info and use it at coding time. When the application is started, the underlying COM DLL will not be loaded until that part of code is called. Is there a similar thing in .Net (C#) application ? When I create C# application, I need to add reference to another assembly if I want to use its classes (I don't want to use reflection here). But this will...
1
1134
by: Jordan S. | last post by:
When an ASP.NET Application first starts, an application pool is created and assemblies loaded into it. How does ASP.NET "know" which assemblies to load - initially - into that application pool? What controls which assemblies are initially loaded? Is it Machine.config + App.config? Is there some other way that ASP.NET knows which assemblies to load... any "hard-coded" that always load no matter what? When does ASP.NET load 3rd party...
8
3131
by: =?Utf-8?B?TWFyaw==?= | last post by:
We've got a wierd failure happening on just one machine. One part of our product uses a 3rd party search implementation (dtSearch). DtSearch has a native core (dten600.dll), late-bound, and a managed wrapper (dtSearchNetApi2.dll). For reasons unknown our build and msi packaging process includes dtSearchNetApi2.dll but not dten600.dll in all packages, as well as a couple of assemblies that reference it, even though they are not used by...
0
8738
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9376
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9230
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9148
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
8026
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
6678
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
5994
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();...
1
3207
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
2146
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.