views:

20

answers:

2

I'm trying to use CreateApplicationHost to create an Asp.Net application host for a simple web server, however I'm getting a System.IO.FileNotFoundException when it attempts to create an instance of my marshalling object:

host = (MyMarshaller)ApplicationHost.CreateApplicationHost((MyMarshaller), virtualDir, physicalDir);

I believe that this error is because it cannot find the assembly containing the class MyMarshaller - if I put this assembly in the bin directory of physicalDir then everything works fine, however I don't want to do this (I also don't want to place my assembly in the GAC either).

Is there any way that I can control where CreateApplicationHost looks for my assembly? (Note that MyMarshaller class is conted in the same assembly as the above line of code)

+1  A: 

How to load an assembly at runtime that is located in a folder that is not the bin folder of the application

If its not in the GAC or BIN you will have to use Assembly.LoadFrom.

Assembly SampleAssembly;
SampleAssembly = Assembly.LoadFrom("c:\\Sample.Assembly.dll");
rick schott
This only has an effect on the current AppDomain - I need to be able to load an assembly in the AppDomain created by CreateApplicationHost.
Kragen
A: 

The short answer is that it isn't possible to do this, however the Cassini source revealed an alternative solution.

Kragen