473,756 Members | 5,595 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

c# run-time load of assembly problem

3 New Member
Hi all.

Here is description of my run-time assembly loading problem:

I would like to have winService hosting .Net remoting objects.
But, it should work in sort of pluginable way, so during starting of winService it would look into certain folder configured with App.config and dynamically load assemblies from deployed dll-s. Registering of remote objects would be done in some AddonXXX: IAddonXXX class that is defined in each dll, and some mutual interface IAddonXXX would be used to identify those addon classes after assembly is loaded in run-time.

This all sound ok, but now I have encounter following problem.

Naturally, my plugin dll references some other dlls, and after loading of assembly when addonAssembly.G etExportedTypes is executed I keep getting this error:

"Could not load file or assembly 'DALXXXModule, Version=1.0.0.0 , Culture=neutral , PublicKeyToken= null' or one of its dependencies. The system cannot find the file specified."

I tried pretty much all I though it could make a difference.

System.Reflecti on.Assembly.Loa d
AppDomain.Curre ntDomain.Load

even I deployed all referenced dlls and load them in order that first are loaded referenced dlls and plugin dll at the end, but error remains same.

So, my question is:

What is correct way to load dll at runtime? And I would prefer if dll should not be stored in GAC.

So, somehow I suppose that this should be common thing to do and there is probably right way to do this... Can anybody help me? Tnx.
Mar 27 '08 #1
2 2908
millevlada
3 New Member
here is also code:
...
System.Reflecti on.Assembly addonAssembly;
XmlDocument xmlConfig;

foreach (string fileName in Directory.GetFi les(FolderName, "*PluginConfigu ration.xml"))
{
xmlConfig = new XmlDocument();
xmlConfig.Load( fileName);
XmlNodeList assemblyIdentit yNodes = xmlConfig.GetEl ementsByTagName ("assemblyIdent ity");

foreach (XmlNode assemblyIdentit yNode in assemblyIdentit yNodes)
{
string dllName = FolderName + "\\" + assemblyIdentit yNode.Attribute s["name"].Value;

byte[] rawAssembly = IOUtils.LoadFil e(dllName);
byte[] rawSymbolStore = IOUtils.LoadFil e(dllName.Subst ring(0, dllName.Length - 3) + "pdb");

addonAssembly = AppDomain.Curre ntDomain.Load(r awAssembly);//, rawSymbolStore) ;

foreach (System.Type exportedType in addonAssembly.G etExportedTypes ())
{
IRemotingBIZMod uleAddon addonInstance;
try
{
addonInstance = (IRemotingBIZMo duleAddon)addon Assembly.Create Instance(export edType.FullName , true);
}
catch (Exception ex)
{
addonInstance = null;
}

if (addonInstance != null)
{
addonInstance.I nstall(logWrite r, this);
}
}
}
}
...


error is raised with addonAssembly.G etExportedTypes ()
Mar 27 '08 #2
millevlada
3 New Member
Ok, I found solution.

following config should be added into App.config of winService project

<runtime>
<assemblyBindin g xmlns="urn:sche mas-microsoft-com:asm.v1">
<probing privatePath="Ad donRemoteObject sFolder" />
</assemblyBinding >
</runtime>

all "private paths" that would be used to hold dll-s must be registered through probing element.

So, this thread can be closed now.
Mar 28 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
4930
by: leroybt.rm | last post by:
Can someone tell me how to run a script from a interactive shell I type the following: >>>python filename >>>python filename.py >>>run filename >>>run filename.py >>>/run filename >>>/run filename.py
4
3217
by: Ed | last post by:
Hello, I took a course in asp about 2 years ago and I was practicing with IIS 5.0. Then I put it down for a while. Now trying to get back to it. I can't run asp files from subdirectories of my root directory, but I can run asp files from the root directory of my website and I can run htm files from the subdirectories. If I run localhost/mytest.asp
5
7042
by: Patrice FRITSCH | last post by:
I'm trying to run a batch file from an asp page using WScript.Shell object. Dim oWSH set oWSH= Server.CreateObject("WScript.Shell") call oWSH.Run("cmd.exe /c " & szCmd , 0, true) szCmd contains the program to execute (fop.bat with several parameters). But I'm getting the following error message :
2
2541
by: Jenna Olson | last post by:
Hi all- I've never seen this particular issue addressed, but was wondering if there's anything to support one way or another. Say I have a class: class ManipulateData { public: ManipulateData(const char* Path-To-Some-Text-File) { ... }
6
20087
by: orekin | last post by:
Hi There I have been trying to come to grips with Application.Run(), Application.Exit() and the Message Pump and I would really appreciate some feedback on the following questions .. There are quite a few words in this post but the questions are actually quite similar and should be fairly quick to answer ... (1) What is Happening with the Threads
3
4472
by: emman_54 | last post by:
Hi every one, I am trying to run a batch file using my asp.net application. I am using the Process class to run the batch file. When I run my web application, In the task manager, i could see cmd.exe with ASPNET as a user. But nothing happens. It can't execute the batch file. This is the code i am using to run the batch file:
9
4684
by: Brett Wesoloski | last post by:
I am new to VS2005. I changed my program.cs file to be a different form I am working on. But when I go to run the application it still brings up the form that was originally declared as new. When I put in a break point the program does not stop. It is in debug mode. If I change the program.cs file back to the form that was originally being used. The program does go into debug mode. But if I change code in that file it isn't using...
8
3017
by: David Thielen | last post by:
Hi; In our setup program how do I determine if I need to run "aspnet_regiis –i" and if so, is there an API I can calll rather than finding that program on the user's disk and calling it? -- thanks - dave david_at_windward_dot_net http://www.windwardreports.com
3
11300
by: traceable1 | last post by:
Is there a way I can set up a SQL script to run when the instance starts up? SQL Server 2005 SP2 thanks!
2
2581
by: a16908 | last post by:
Please help me, I need a help. I want to know how to make my PC run fast. I did every thing like :1. Run Disk clean-up. Then delete unused files. (start>program>accessories>sys... tools> disk clean-up) 2. Check for disk errors. (right click on a disk-drive>properties>tools >error checking, then restart) 3. Run disk defragmenter for all drives. 4. Delete cookies. (you can do it from your browser options: tools>internet options) 5. Delete...
0
10040
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
9873
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
9846
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
9713
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
8713
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
7248
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
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3806
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
2666
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.