I am trying to dynamically load an assembly that has a reference to
'Interop.WMEnco derLib.dll' which is a PIA to the windows media player DRM
components. When I run the code from a console application it works
perfectly fine, but when the assembly containing the reference is load from
a windows service an exception is thrown with the following message:
"File or assembly name Interop.WMEncod erLib, or one of its dependencies, was
not found."
Now I am guessing this is because the windows service runs under the
location of 'windows root\system32' not where there service execute is
installed. The assemblies I am loading at runtime resides in a sub directory
(with all the dll's referenced by the assembly) and are designed as a
plugable architecture that returns an interface to the caller.
public static IIngestor CreateInstance( string assemblyName, string
classType, object[] args)
{
Assembly loadedAssembly = Assembly.LoadFr om(assemblyName );
IIngestor ingestor = (IIngestor)load edAssembly.Crea teInstance(clas sType,
true, BindingFlags.De fault, null, args, null, null);
if(ingestor == null)
throw new System.Argument Exception("Fail ed to create ingestor
invalid assembly or class name, assembly = '" + assemblyName + "', class
name ='" + classType + "'.");
return ingestor;
}
Can anyone help me out here
Cheers
Ollie Riches 7 3040
Ollie, I am trying to dynamically load an assembly that has a reference to 'Interop.WMEnco derLib.dll' which is a PIA to the windows media player DRM components. When I run the code from a console application it works perfectly fine, but when the assembly containing the reference is load from a windows service an exception is thrown with the following message:
If that assembly is a PIA, why don't you install it into the GAC?
Rob
Good Idea :) and probably will work, but doesn't explain why the assembly
isn't loading
Ollie
"Robert Jordan" <ro*****@gmx.ne t> wrote in message
news:di******** *****@news.t-online.com... Ollie,
I am trying to dynamically load an assembly that has a reference to 'Interop.WMEnco derLib.dll' which is a PIA to the windows media player DRM components. When I run the code from a console application it works perfectly fine, but when the assembly containing the reference is load from a windows service an exception is thrown with the following message:
If that assembly is a PIA, why don't you install it into the GAC?
Rob
found this and will have a look at it tomorrow: http://blogs.msdn.com/suzcook/archiv.../29/57120.aspx
Ollie
"Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
news:u2******** ******@TK2MSFTN GP14.phx.gbl... Good Idea :) and probably will work, but doesn't explain why the assembly isn't loading
Ollie
"Robert Jordan" <ro*****@gmx.ne t> wrote in message news:di******** *****@news.t-online.com... Ollie,
I am trying to dynamically load an assembly that has a reference to 'Interop.WMEnco derLib.dll' which is a PIA to the windows media player DRM components. When I run the code from a console application it works perfectly fine, but when the assembly containing the reference is load from a windows service an exception is thrown with the following message:
If that assembly is a PIA, why don't you install it into the GAC?
Rob
I think I will try using the AssemblyResolve event on the current appDomain
to see if that can help resolve the location of the interop assembly.
found an interresting google at: http://groups.google.com/group/micro...ac04b9a4d3128d
Ollie
"Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. .. found this and will have a look at it tomorrow:
http://blogs.msdn.com/suzcook/archiv.../29/57120.aspx
Ollie
"Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message news:u2******** ******@TK2MSFTN GP14.phx.gbl... Good Idea :) and probably will work, but doesn't explain why the assembly isn't loading
Ollie
"Robert Jordan" <ro*****@gmx.ne t> wrote in message news:di******** *****@news.t-online.com... Ollie,
I am trying to dynamically load an assembly that has a reference to 'Interop.WMEnco derLib.dll' which is a PIA to the windows media player DRM components. When I run the code from a console application it works perfectly fine, but when the assembly containing the reference is load from a windows service an exception is thrown with the following message:
If that assembly is a PIA, why don't you install it into the GAC?
Rob
Still failing, but if I place the assemblies in the same directory as the
service binary then it loads the assemblies perfrectly fine.
I have tried using the AssemblyResolve event and the AppendPrivatePa th on
the current app domain but still it fails
Ollie
"Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
news:%2******** ************@TK 2MSFTNGP09.phx. gbl... I think I will try using the AssemblyResolve event on the current appDomain to see if that can help resolve the location of the interop assembly.
found an interresting google at:
http://groups.google.com/group/micro...ac04b9a4d3128d
Ollie
"Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message news:%2******** ********@TK2MSF TNGP15.phx.gbl. .. found this and will have a look at it tomorrow:
http://blogs.msdn.com/suzcook/archiv.../29/57120.aspx
Ollie
"Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message news:u2******** ******@TK2MSFTN GP14.phx.gbl... Good Idea :) and probably will work, but doesn't explain why the assembly isn't loading
Ollie
"Robert Jordan" <ro*****@gmx.ne t> wrote in message news:di******** *****@news.t-online.com... Ollie,
> I am trying to dynamically load an assembly that has a reference to > 'Interop.WMEnco derLib.dll' which is a PIA to the windows media player > DRM components. When I run the code from a console application it > works perfectly fine, but when the assembly containing the reference > is load from a windows service an exception is thrown with the > following message:
If that assembly is a PIA, why don't you install it into the GAC?
Rob
Hi Ollie, Still failing, but if I place the assemblies in the same directory as the service binary then it loads the assemblies perfrectly fine.
I have tried using the AssemblyResolve event and the AppendPrivatePa th on the current app domain but still it fails
Are you still using Assembly.LoadFr om? This method is
actually loading the assembly either from the full path
you specified or relatively to the app's current directory.
Try Assembly.Load with the strong name of the PIA.
For the first, the strong name can be as simple as
"Interop.WMEnco derLib", but take a look at "gacutil -l"
output for the full name.
Rob
Cheers for the help Robert, I have been using LoadFrom with fully qualified
path with no success.
I will have to resort to either putting the plugin dll's in the same
directory as the windows service or as you suggested registering the PIA's
in the GAC. But for now i have it working and will address this problem
again next week.
Cheers for the help
Ollie
"Robert Jordan" <ro*****@gmx.ne t> wrote in message
news:di******** *****@news.t-online.com... Hi Ollie,
Still failing, but if I place the assemblies in the same directory as the service binary then it loads the assemblies perfrectly fine.
I have tried using the AssemblyResolve event and the AppendPrivatePa th on the current app domain but still it fails
Are you still using Assembly.LoadFr om? This method is actually loading the assembly either from the full path you specified or relatively to the app's current directory.
Try Assembly.Load with the strong name of the PIA.
For the first, the strong name can be as simple as "Interop.WMEnco derLib", but take a look at "gacutil -l" output for the full name.
Rob This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: David Elliott |
last post by:
I am trying to load an assembly and execute a method from a class.
I have listed 3 parts to the code.
1) The Driver to load and execute
2) The Interface
3) The assembly
I have a valid referece to the assembly. When I try to create an instance
of the class, it returns a null value.
Any help would be appreciated.
|
by: KK |
last post by:
Hi all
Can anybody help me what's going wrong here and how to correct it.
Code is as follows....
System::Object * GetObjectFromAssembly()
{
Assembly * pMyAssembly = Assembly::Load("MyAssembly");
Type * pMyType = pMyAssembly->GetType("MyNameSpace.MyClass");
System::Object * pRet = pMyType->CreateInstance();
pMyAssembly = 0;
|
by: Vivek |
last post by:
HI Everyone,
I am trying to dynamically load a custom deployed assembly from the GAC of a
remote machine so that i could call its method from my code using
reflection. Can anyone tell me how do i do this? Any help would be
appreciated.
Thanks
Vivek
|
by: Benjamin |
last post by:
Hi,
I'm currently writing a Web Services that interacts with a database.
To allow me to use not just one database provider (for example, I
could use MS Access, SQL Server or MySQL), the Web Service dynamically
loads up an assembly that implements an Interface I called IDatabase.
To load the assembly and create an object, I wrote this function:
private IDatabase LoadDatabasePlugin( string assemblyFile, string
|
by: M. Fitzgerald |
last post by:
Our migration from ASP to ASP.NET will be a slow one. In themeantime, I have constructed a .NET assembly and registered itas a COM object for use in out classic ASP pages. One of thethings this particular assembly does is use Reflection todynamically load another assembly (based of course onuser-provided parameters).
The original error is in that it could not locate the assembly tobe loaded. I've tried placing the dynamically loaded...
| |
by: Pradeep |
last post by:
Hi,
We devised smart client technology in our application.
We used web service to download a assembly which is there
in system32 folder of web server using "System.Reflection"
MyAssembly = .LoadFrom("AsmSACM.dll")
Application has been successfully deployed in windows 2000
|
by: Dan Dorey |
last post by:
I actually have two questions here, but I'll start by giving an outline
of what I'm trying to do.
I'm building an app with a simple plugin architecture (all in the same
app domain). I have each plugin in a separate sub-dir inside a
"Plugins" directory. Each plugin consists of at least two DLLs (a
controller and a driver). However, most drivers also rely on other
external DLLs.
In one particular case this dependency is to a C++ DLL...
|
by: Smithers |
last post by:
Using 3.5, I am stuck in attempting to:
1. Dynamically load an assembly
2. Instantiate a class from that assembly (the client code is in a different
namespace than the namespace of the dynamically loaded assembly)
so far so good (per my code below)... but here is where I'm getting hung up:
3. Call methods of that type (see comments in my code)
If the types in the dynamically loaded assembly were in the same namespace
|
by: chage |
last post by:
Hi,
I have been searching around to try adding reference assembly to
another assembly during runtime, programatically. Is this possible
in .Net?
The reason for this is because i am having trouble using a library
that creates an instance of a Type that i specified, and it failed the
locate the Type during runtime, if i do not reference it during
compile time.
|
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,...
|
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...
| |
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...
|
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,...
|
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...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |