Hello,
I created a small app which acts as a services manager. I basically drop a
DLL in a Services folder and set the frequency through the application for
how often do I want the code in the assembly to run (scheduler).
I created a seperate AppDomain here is the code:
....
AppDomainSetup ads = new AppDomainSetup();
string path =
Application.ExecutablePath.Replace(System.IO.Path. GetFileName(Application.Ex
ecutablePath),"");
ads.ApplicationBase = path + "Services";
ads.PrivateBinPathProbe = path + "Services";
ads.PrivateBinPath = path + "Services";
ads.DisallowBindingRedirects = true;
Tools.ShowInfo(path);
SvcBin = AppDomain.CreateDomain("ServiceAssemblies",null,ad s);
....
The above code was placed in the constructor. When I look through the
assemblies (GetAssemblies) to see a listing of all classes loaded, I don't
see the classes in the dll located in that services folder, which made me
think that it is not being probed. Anything I'm doing wrong?
--
Abdellah Elamiri
..net Developer
Efficacy through simplicity 8 4890
The code you have by itself won't cause the assemblies in the Services
folder to be loaded -- it just creates a AppDomain. The assemblies will be
loaded the first time you create an instance of an object from one of them
(e.g., with AppDomain.CreateInstance()) or when you explicitly load them
(e.g., with AppDomain.Load()).
Ken
"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message
news:OE**************@TK2MSFTNGP11.phx.gbl... Hello,
I created a small app which acts as a services manager. I basically drop a DLL in a Services folder and set the frequency through the application for how often do I want the code in the assembly to run (scheduler).
I created a seperate AppDomain here is the code: ... AppDomainSetup ads = new AppDomainSetup(); string path =
Application.ExecutablePath.Replace(System.IO.Path. GetFileName(Application.Ex ecutablePath),""); ads.ApplicationBase = path + "Services"; ads.PrivateBinPathProbe = path + "Services"; ads.PrivateBinPath = path + "Services"; ads.DisallowBindingRedirects = true; Tools.ShowInfo(path); SvcBin = AppDomain.CreateDomain("ServiceAssemblies",null,ad s);
...
The above code was placed in the constructor. When I look through the assemblies (GetAssemblies) to see a listing of all classes loaded, I don't see the classes in the dll located in that services folder, which made me think that it is not being probed. Anything I'm doing wrong? -- Abdellah Elamiri .net Developer Efficacy through simplicity
In the code you have posted you have created the domain. but you haven't
loaded the assembly yet.
On the created domain you should call Load and pass the assembly which you
are trying to load as a param.
This time you don't have to pass any path information because that was
already supplied to the AppDomainSetup object.
regards,
Abhishek.
"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message
news:OE**************@TK2MSFTNGP11.phx.gbl... Hello,
I created a small app which acts as a services manager. I basically drop a DLL in a Services folder and set the frequency through the application for how often do I want the code in the assembly to run (scheduler).
I created a seperate AppDomain here is the code: ... AppDomainSetup ads = new AppDomainSetup(); string path =
Application.ExecutablePath.Replace(System.IO.Path. GetFileName(Application.Ex ecutablePath),""); ads.ApplicationBase = path + "Services"; ads.PrivateBinPathProbe = path + "Services"; ads.PrivateBinPath = path + "Services"; ads.DisallowBindingRedirects = true; Tools.ShowInfo(path); SvcBin = AppDomain.CreateDomain("ServiceAssemblies",null,ad s);
...
The above code was placed in the constructor. When I look through the assemblies (GetAssemblies) to see a listing of all classes loaded, I don't see the classes in the dll located in that services folder, which made me think that it is not being probed. Anything I'm doing wrong? -- Abdellah Elamiri .net Developer Efficacy through simplicity
Thanks for the replies, but now I'm getting a different error
Additional information: Insufficient state to deserialize the object. More
information is needed.
this occurs at this line
OwnerForm.SvcBin.Load("ClintonServices");
SvcBin is an AppDomain created by the OwnerForm, OwnerForm is simply the
parent windows form
--
Abdellah Elamiri
..net Developer
Efficacy through simplicity
"Abhishek Srivastava" <ab******@nospam.net> wrote in message
news:uK**************@TK2MSFTNGP12.phx.gbl... In the code you have posted you have created the domain. but you haven't loaded the assembly yet.
On the created domain you should call Load and pass the assembly which you are trying to load as a param.
This time you don't have to pass any path information because that was already supplied to the AppDomainSetup object.
regards, Abhishek.
"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message news:OE**************@TK2MSFTNGP11.phx.gbl... Hello,
I created a small app which acts as a services manager. I basically drop
a DLL in a Services folder and set the frequency through the application
for how often do I want the code in the assembly to run (scheduler).
I created a seperate AppDomain here is the code: ... AppDomainSetup ads = new AppDomainSetup(); string path =
Application.ExecutablePath.Replace(System.IO.Path. GetFileName(Application.Ex ecutablePath),""); ads.ApplicationBase = path + "Services"; ads.PrivateBinPathProbe = path + "Services"; ads.PrivateBinPath = path + "Services"; ads.DisallowBindingRedirects = true; Tools.ShowInfo(path); SvcBin = AppDomain.CreateDomain("ServiceAssemblies",null,ad s);
...
The above code was placed in the constructor. When I look through the assemblies (GetAssemblies) to see a listing of all classes loaded, I
don't see the classes in the dll located in that services folder, which made
me think that it is not being probed. Anything I'm doing wrong? -- Abdellah Elamiri .net Developer Efficacy through simplicity
When you call AppDomain.Load() from a different AppDomain than the one in
which the assembly is loaded, you can often run into this problem. What's
happened is the assembly is indeed loaded into the other app domain. But, it
then attempts to return the assembly reference to the calling AppDomain.
That requires the calling AppDomain to load the assembly as well. But, since
the assembly isn't in the calling AppDomain's probing path (current
directory), the load fails.
Ken
"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl... Thanks for the replies, but now I'm getting a different error
Additional information: Insufficient state to deserialize the object.
More information is needed.
this occurs at this line OwnerForm.SvcBin.Load("ClintonServices");
SvcBin is an AppDomain created by the OwnerForm, OwnerForm is simply the parent windows form
-- Abdellah Elamiri .net Developer Efficacy through simplicity "Abhishek Srivastava" <ab******@nospam.net> wrote in message news:uK**************@TK2MSFTNGP12.phx.gbl... In the code you have posted you have created the domain. but you haven't loaded the assembly yet.
On the created domain you should call Load and pass the assembly which
you are trying to load as a param.
This time you don't have to pass any path information because that was already supplied to the AppDomainSetup object.
regards, Abhishek.
"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message news:OE**************@TK2MSFTNGP11.phx.gbl... Hello,
I created a small app which acts as a services manager. I basically
drop a DLL in a Services folder and set the frequency through the application for how often do I want the code in the assembly to run (scheduler).
I created a seperate AppDomain here is the code: ... AppDomainSetup ads = new AppDomainSetup(); string path =
Application.ExecutablePath.Replace(System.IO.Path. GetFileName(Application.Ex ecutablePath),""); ads.ApplicationBase = path + "Services"; ads.PrivateBinPathProbe = path + "Services"; ads.PrivateBinPath = path + "Services"; ads.DisallowBindingRedirects = true; Tools.ShowInfo(path); SvcBin = AppDomain.CreateDomain("ServiceAssemblies",null,ad s);
...
The above code was placed in the constructor. When I look through the assemblies (GetAssemblies) to see a listing of all classes loaded, I don't see the classes in the dll located in that services folder, which made me think that it is not being probed. Anything I'm doing wrong? -- Abdellah Elamiri .net Developer Efficacy through simplicity
That helped! thanks a lot everyone who answered
--
Abdellah Elamiri
..net Developer
Efficacy through simplicity
"Ken Kolda" <ke*******@elliemae-nospamplease.com> wrote in message
news:ui**************@tk2msftngp13.phx.gbl... When you call AppDomain.Load() from a different AppDomain than the one in which the assembly is loaded, you can often run into this problem. What's happened is the assembly is indeed loaded into the other app domain. But,
it then attempts to return the assembly reference to the calling AppDomain. That requires the calling AppDomain to load the assembly as well. But,
since the assembly isn't in the calling AppDomain's probing path (current directory), the load fails.
Ken
"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message news:%2******************@TK2MSFTNGP12.phx.gbl... Thanks for the replies, but now I'm getting a different error
Additional information: Insufficient state to deserialize the object. More information is needed.
this occurs at this line OwnerForm.SvcBin.Load("ClintonServices");
SvcBin is an AppDomain created by the OwnerForm, OwnerForm is simply the parent windows form
-- Abdellah Elamiri .net Developer Efficacy through simplicity "Abhishek Srivastava" <ab******@nospam.net> wrote in message news:uK**************@TK2MSFTNGP12.phx.gbl... In the code you have posted you have created the domain. but you
haven't loaded the assembly yet.
On the created domain you should call Load and pass the assembly which you are trying to load as a param.
This time you don't have to pass any path information because that was already supplied to the AppDomainSetup object.
regards, Abhishek.
"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in
message news:OE**************@TK2MSFTNGP11.phx.gbl... > Hello, > > I created a small app which acts as a services manager. I basically drop a > DLL in a Services folder and set the frequency through the
application for > how often do I want the code in the assembly to run (scheduler). > > I created a seperate AppDomain here is the code: > ... > AppDomainSetup ads = new AppDomainSetup(); > string path = >
Application.ExecutablePath.Replace(System.IO.Path. GetFileName(Application.Ex > ecutablePath),""); > ads.ApplicationBase = path + "Services"; > ads.PrivateBinPathProbe = path + "Services"; > ads.PrivateBinPath = path + "Services"; > ads.DisallowBindingRedirects = true; > Tools.ShowInfo(path); > SvcBin = AppDomain.CreateDomain("ServiceAssemblies",null,ad s); > > ... > > The above code was placed in the constructor. When I look through
the > assemblies (GetAssemblies) to see a listing of all classes loaded, I don't > see the classes in the dll located in that services folder, which
made me > think that it is not being probed. Anything I'm doing wrong? > -- > Abdellah Elamiri > .net Developer > Efficacy through simplicity > >
Hi Ken,
just curious (never had to deal with this) - how the you load an
assembly in the new appdomain without loading it in the calling one?
Sunny
In article <ui**************@tk2msftngp13.phx.gbl>, ken.kolda@elliemae-
nospamplease.com says... When you call AppDomain.Load() from a different AppDomain than the one in which the assembly is loaded, you can often run into this problem. What's happened is the assembly is indeed loaded into the other app domain. But, it then attempts to return the assembly reference to the calling AppDomain. That requires the calling AppDomain to load the assembly as well. But, since the assembly isn't in the calling AppDomain's probing path (current directory), the load fails.
Ken
"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message news:%2******************@TK2MSFTNGP12.phx.gbl... Thanks for the replies, but now I'm getting a different error
Additional information: Insufficient state to deserialize the object. More information is needed.
this occurs at this line OwnerForm.SvcBin.Load("ClintonServices");
SvcBin is an AppDomain created by the OwnerForm, OwnerForm is simply the parent windows form
-- Abdellah Elamiri .net Developer Efficacy through simplicity "Abhishek Srivastava" <ab******@nospam.net> wrote in message news:uK**************@TK2MSFTNGP12.phx.gbl... In the code you have posted you have created the domain. but you haven't loaded the assembly yet.
On the created domain you should call Load and pass the assembly which you are trying to load as a param.
This time you don't have to pass any path information because that was already supplied to the AppDomainSetup object.
regards, Abhishek.
"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message news:OE**************@TK2MSFTNGP11.phx.gbl... > Hello, > > I created a small app which acts as a services manager. I basically drop a > DLL in a Services folder and set the frequency through the application for > how often do I want the code in the assembly to run (scheduler). > > I created a seperate AppDomain here is the code: > ... > AppDomainSetup ads = new AppDomainSetup(); > string path = > Application.ExecutablePath.Replace(System.IO.Path. GetFileName(Application.Ex > ecutablePath),""); > ads.ApplicationBase = path + "Services"; > ads.PrivateBinPathProbe = path + "Services"; > ads.PrivateBinPath = path + "Services"; > ads.DisallowBindingRedirects = true; > Tools.ShowInfo(path); > SvcBin = AppDomain.CreateDomain("ServiceAssemblies",null,ad s); > > ... > > The above code was placed in the constructor. When I look through the > assemblies (GetAssemblies) to see a listing of all classes loaded, I don't > see the classes in the dll located in that services folder, which made me > think that it is not being probed. Anything I'm doing wrong? > -- > Abdellah Elamiri > .net Developer > Efficacy through simplicity > >
I've done this using the AppDomain.DoCallback(). Make sure the delegate is
marshal-by-value and have the delegate that's invoked call
AppDomain.CurrentDomain.Load(). Of course, that means the new appdomain will
have to load the assembly that contains the definition of the class
containing the delegate, so hopefully that's acceptable.
Ken
"Sunny" <su***@newsgroups.nospam> wrote in message
news:e$**************@TK2MSFTNGP09.phx.gbl... Hi Ken,
just curious (never had to deal with this) - how the you load an assembly in the new appdomain without loading it in the calling one?
Sunny
In article <ui**************@tk2msftngp13.phx.gbl>, ken.kolda@elliemae- nospamplease.com says... When you call AppDomain.Load() from a different AppDomain than the one
in which the assembly is loaded, you can often run into this problem.
What's happened is the assembly is indeed loaded into the other app domain.
But, it then attempts to return the assembly reference to the calling AppDomain. That requires the calling AppDomain to load the assembly as well. But,
since the assembly isn't in the calling AppDomain's probing path (current directory), the load fails.
Ken
"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message news:%2******************@TK2MSFTNGP12.phx.gbl... Thanks for the replies, but now I'm getting a different error
Additional information: Insufficient state to deserialize the object. More information is needed.
this occurs at this line OwnerForm.SvcBin.Load("ClintonServices");
SvcBin is an AppDomain created by the OwnerForm, OwnerForm is simply
the parent windows form
-- Abdellah Elamiri .net Developer Efficacy through simplicity "Abhishek Srivastava" <ab******@nospam.net> wrote in message news:uK**************@TK2MSFTNGP12.phx.gbl... > In the code you have posted you have created the domain. but you
haven't > loaded the assembly yet. > > On the created domain you should call Load and pass the assembly
which you > are trying to load as a param. > > This time you don't have to pass any path information because that
was > already supplied to the AppDomainSetup object. > > regards, > Abhishek. > > "A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in
message > news:OE**************@TK2MSFTNGP11.phx.gbl... > > Hello, > > > > I created a small app which acts as a services manager. I
basically drop a > > DLL in a Services folder and set the frequency through the
application for > > how often do I want the code in the assembly to run (scheduler). > > > > I created a seperate AppDomain here is the code: > > ... > > AppDomainSetup ads = new AppDomainSetup(); > > string path = > > >
Application.ExecutablePath.Replace(System.IO.Path. GetFileName(Application.Ex > > ecutablePath),""); > > ads.ApplicationBase = path + "Services"; > > ads.PrivateBinPathProbe = path + "Services"; > > ads.PrivateBinPath = path + "Services"; > > ads.DisallowBindingRedirects = true; > > Tools.ShowInfo(path); > > SvcBin = AppDomain.CreateDomain("ServiceAssemblies",null,ad s); > > > > ... > > > > The above code was placed in the constructor. When I look through
the > > assemblies (GetAssemblies) to see a listing of all classes loaded,
I don't > > see the classes in the dll located in that services folder, which
made me > > think that it is not being probed. Anything I'm doing wrong? > > -- > > Abdellah Elamiri > > .net Developer > > Efficacy through simplicity > > > > > >
Thanks
In article <OY**************@TK2MSFTNGP11.phx.gbl>, ken.kolda@elliemae-
nospamplease.com says... I've done this using the AppDomain.DoCallback(). Make sure the delegate is marshal-by-value and have the delegate that's invoked call AppDomain.CurrentDomain.Load(). Of course, that means the new appdomain will have to load the assembly that contains the definition of the class containing the delegate, so hopefully that's acceptable.
Ken
"Sunny" <su***@newsgroups.nospam> wrote in message news:e$**************@TK2MSFTNGP09.phx.gbl... Hi Ken,
just curious (never had to deal with this) - how the you load an assembly in the new appdomain without loading it in the calling one?
Sunny
In article <ui**************@tk2msftngp13.phx.gbl>, ken.kolda@elliemae- nospamplease.com says... When you call AppDomain.Load() from a different AppDomain than the one in which the assembly is loaded, you can often run into this problem. What's happened is the assembly is indeed loaded into the other app domain. But, it then attempts to return the assembly reference to the calling AppDomain. That requires the calling AppDomain to load the assembly as well. But, since the assembly isn't in the calling AppDomain's probing path (current directory), the load fails.
Ken
"A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message news:%2******************@TK2MSFTNGP12.phx.gbl... > Thanks for the replies, but now I'm getting a different error > > Additional information: Insufficient state to deserialize the object. More > information is needed. > > this occurs at this line > OwnerForm.SvcBin.Load("ClintonServices"); > > SvcBin is an AppDomain created by the OwnerForm, OwnerForm is simply the > parent windows form > > > -- > Abdellah Elamiri > .net Developer > Efficacy through simplicity > "Abhishek Srivastava" <ab******@nospam.net> wrote in message > news:uK**************@TK2MSFTNGP12.phx.gbl... > > In the code you have posted you have created the domain. but you haven't > > loaded the assembly yet. > > > > On the created domain you should call Load and pass the assembly which you > > are trying to load as a param. > > > > This time you don't have to pass any path information because that was > > already supplied to the AppDomainSetup object. > > > > regards, > > Abhishek. > > > > "A. Elamiri" <abdellahDOTelamiriATclintonDOTedutNOSPAM> wrote in message > > news:OE**************@TK2MSFTNGP11.phx.gbl... > > > Hello, > > > > > > I created a small app which acts as a services manager. I basically drop > a > > > DLL in a Services folder and set the frequency through the application > for > > > how often do I want the code in the assembly to run (scheduler). > > > > > > I created a seperate AppDomain here is the code: > > > ... > > > AppDomainSetup ads = new AppDomainSetup(); > > > string path = > > > > > > Application.ExecutablePath.Replace(System.IO.Path. GetFileName(Application.Ex > > > ecutablePath),""); > > > ads.ApplicationBase = path + "Services"; > > > ads.PrivateBinPathProbe = path + "Services"; > > > ads.PrivateBinPath = path + "Services"; > > > ads.DisallowBindingRedirects = true; > > > Tools.ShowInfo(path); > > > SvcBin = AppDomain.CreateDomain("ServiceAssemblies",null,ad s); > > > > > > ... > > > > > > The above code was placed in the constructor. When I look through the > > > assemblies (GetAssemblies) to see a listing of all classes loaded, I > don't > > > see the classes in the dll located in that services folder, which made > me > > > think that it is not being probed. Anything I'm doing wrong? > > > -- > > > Abdellah Elamiri > > > .net Developer > > > Efficacy through simplicity > > > > > > > > > > > > This discussion thread is closed Replies have been disabled for this discussion. Similar topics
2 posts
views
Thread by Satinderpal Singh |
last post: by
|
4 posts
views
Thread by stu_pb |
last post: by
|
1 post
views
Thread by BuddyWork |
last post: by
|
reply
views
Thread by Tyrven |
last post: by
|
5 posts
views
Thread by Benny Raymond |
last post: by
|
4 posts
views
Thread by =?Utf-8?B?SmFu?= |
last post: by
|
10 posts
views
Thread by =?Utf-8?B?U3RlZmFuIEJhcmxvdw==?= |
last post: by
|
reply
views
Thread by Boni Lopez |
last post: by
|
4 posts
views
Thread by illegal.prime |
last post: by
| | | | | | | | | | |