473,545 Members | 2,055 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 2230
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
3111
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...
3
2486
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...
9
4469
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 ...
6
4490
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...
7
10941
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...
0
2309
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
1845
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...
1
1123
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...
8
3119
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...
0
7475
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...
0
7409
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...
0
7918
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...
1
7436
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...
1
5341
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...
0
3463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1897
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
1
1022
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
715
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...

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.