473,387 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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.CurrentDomain.Load(byte[] 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.CurrentDomain.CreateInstance("CustomAsse mbly, 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.CurrentDomain.GetAssemblies().
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_b9bac801/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 2222
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.CurrentDomain.Load(byte[] 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.CurrentDomain.CreateInstance("CustomAsse mbly, 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.CurrentDomain.GetAssemblies().
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_b9bac801/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
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...
3
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...
9
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...
6
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,...
7
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...
0
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...
2
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...
1
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?...
8
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.