[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

Loading remotable object host app in an AppDomain

Ratan

9/16/2004 5:41:00 AM

Hi,
I have a remotable object 'RemotObj' in "RemoteObj.dll" assembly. This
object is hosted in "RemoteObjHost.exe" assembly. I have a console app
"Test.exe" and want to run "RemoteObjHost.exe" in a new App Domain of
Test.exe process.
My code in "Test.exe" is as follows:

AppDomainSetup *domaininfo = new AppDomainSetup();
domaininfo->ApplicationBase = "F:\\RemoteObjHost\\Debug";
domaininfo->PrivateBinPath = AppDomain::CurrentDomain->BaseDirectory;
domaininfo->ApplicationName = "RemoteObjHost";
AppDomain *dom1 = AppDomain::CreateDomain(S"dom1", 0, domaininfo);
dom1->ExecuteAssembly(S"RemoteObjHost.exe");

It gives the exception "File or assembly name RemoteObjHost.exe, or one of
its dependencies, was not found.".

I have also tried to put all the assemblies in the same folder but same
exception.

Can anybody help me?

Thanks.
3 Answers

Ken Kolda

9/16/2004 5:33:00 PM

0

It looks like you're trying to set the PrivateBinPath to a folder which is
not a subdirectory of the ApplicationBase for the AppDomain. The
PrivateBinPath must be a semi-colon-delimited list of subdirectories of the
ApplicationBase, e.g. "bin;somedir\somesubdir". So, try copying your
RemoteObj.dll (and any of its dependencies) into the RemoteHostObj\Debug
folder and see if it works.

Ken


"Ratan" <Ratan@discussions.microsoft.com> wrote in message
news:2D6E7D8B-AA3A-4774-9EE6-DCEB9852FBB2@microsoft.com...
> Hi,
> I have a remotable object 'RemotObj' in "RemoteObj.dll" assembly. This
> object is hosted in "RemoteObjHost.exe" assembly. I have a console app
> "Test.exe" and want to run "RemoteObjHost.exe" in a new App Domain of
> Test.exe process.
> My code in "Test.exe" is as follows:
>
> AppDomainSetup *domaininfo = new AppDomainSetup();
> domaininfo->ApplicationBase = "F:\\RemoteObjHost\\Debug";
> domaininfo->PrivateBinPath = AppDomain::CurrentDomain->BaseDirectory;
> domaininfo->ApplicationName = "RemoteObjHost";
> AppDomain *dom1 = AppDomain::CreateDomain(S"dom1", 0, domaininfo);
> dom1->ExecuteAssembly(S"RemoteObjHost.exe");
>
> It gives the exception "File or assembly name RemoteObjHost.exe, or one of
> its dependencies, was not found.".
>
> I have also tried to put all the assemblies in the same folder but same
> exception.
>
> Can anybody help me?
>
> Thanks.


Ratan

9/21/2004 5:11:00 AM

0

Hi Ken,
Thanks for your response.
I have tried to make release build and copy all the files in one directory
and run. But same problem.

Then I converted all the DLLs and EXE code into VC# then it works without
any modification. Why is this?

Is there some problem in VC++.NET, if we try to run an application in an
AppDomain? Because, when I write an application using VC# and try to execute
it in an AppDomain it works. But if these are developed using VC++.NET, then
we receive exception "File or assembly name %s, or one of its dependencies,
was not found".

Please help, otherwise we need to convert all VC++.NET code to VC#.

Regards,
RATAN

"Ken Kolda" wrote:

> It looks like you're trying to set the PrivateBinPath to a folder which is
> not a subdirectory of the ApplicationBase for the AppDomain. The
> PrivateBinPath must be a semi-colon-delimited list of subdirectories of the
> ApplicationBase, e.g. "bin;somedir\somesubdir". So, try copying your
> RemoteObj.dll (and any of its dependencies) into the RemoteHostObj\Debug
> folder and see if it works.
>
> Ken
>
>
> "Ratan" <Ratan@discussions.microsoft.com> wrote in message
> news:2D6E7D8B-AA3A-4774-9EE6-DCEB9852FBB2@microsoft.com...
> > Hi,
> > I have a remotable object 'RemotObj' in "RemoteObj.dll" assembly. This
> > object is hosted in "RemoteObjHost.exe" assembly. I have a console app
> > "Test.exe" and want to run "RemoteObjHost.exe" in a new App Domain of
> > Test.exe process.
> > My code in "Test.exe" is as follows:
> >
> > AppDomainSetup *domaininfo = new AppDomainSetup();
> > domaininfo->ApplicationBase = "F:\\RemoteObjHost\\Debug";
> > domaininfo->PrivateBinPath = AppDomain::CurrentDomain->BaseDirectory;
> > domaininfo->ApplicationName = "RemoteObjHost";
> > AppDomain *dom1 = AppDomain::CreateDomain(S"dom1", 0, domaininfo);
> > dom1->ExecuteAssembly(S"RemoteObjHost.exe");
> >
> > It gives the exception "File or assembly name RemoteObjHost.exe, or one of
> > its dependencies, was not found.".
> >
> > I have also tried to put all the assemblies in the same folder but same
> > exception.
> >
> > Can anybody help me?
> >
> > Thanks.
>
>
>

Ken Kolda

9/21/2004 10:50:00 PM

0

Sorry -- I don't know much about VC++.NET. But, I can't think of an obvious
reason why the choice of language should make a difference here. The .NET
probing rules are independent of the language used, so my assumption would
be that, in the translation from C++ to C#, something changed which resolved
the problem. You may want to step through teh two sets of code and verify
that they're doing the exact same thing.

Ken


"RATAN" <RATAN@discussions.microsoft.com> wrote in message
news:40D8CB89-55B4-4F19-B9C5-A28E64E15A44@microsoft.com...
> Hi Ken,
> Thanks for your response.
> I have tried to make release build and copy all the files in one directory
> and run. But same problem.
>
> Then I converted all the DLLs and EXE code into VC# then it works without
> any modification. Why is this?
>
> Is there some problem in VC++.NET, if we try to run an application in an
> AppDomain? Because, when I write an application using VC# and try to
execute
> it in an AppDomain it works. But if these are developed using VC++.NET,
then
> we receive exception "File or assembly name %s, or one of its
dependencies,
> was not found".
>
> Please help, otherwise we need to convert all VC++.NET code to VC#.
>
> Regards,
> RATAN
>
> "Ken Kolda" wrote:
>
> > It looks like you're trying to set the PrivateBinPath to a folder which
is
> > not a subdirectory of the ApplicationBase for the AppDomain. The
> > PrivateBinPath must be a semi-colon-delimited list of subdirectories of
the
> > ApplicationBase, e.g. "bin;somedir\somesubdir". So, try copying your
> > RemoteObj.dll (and any of its dependencies) into the RemoteHostObj\Debug
> > folder and see if it works.
> >
> > Ken
> >
> >
> > "Ratan" <Ratan@discussions.microsoft.com> wrote in message
> > news:2D6E7D8B-AA3A-4774-9EE6-DCEB9852FBB2@microsoft.com...
> > > Hi,
> > > I have a remotable object 'RemotObj' in "RemoteObj.dll" assembly. This
> > > object is hosted in "RemoteObjHost.exe" assembly. I have a console app
> > > "Test.exe" and want to run "RemoteObjHost.exe" in a new App Domain of
> > > Test.exe process.
> > > My code in "Test.exe" is as follows:
> > >
> > > AppDomainSetup *domaininfo = new AppDomainSetup();
> > > domaininfo->ApplicationBase = "F:\\RemoteObjHost\\Debug";
> > > domaininfo->PrivateBinPath = AppDomain::CurrentDomain->BaseDirectory;
> > > domaininfo->ApplicationName = "RemoteObjHost";
> > > AppDomain *dom1 = AppDomain::CreateDomain(S"dom1", 0, domaininfo);
> > > dom1->ExecuteAssembly(S"RemoteObjHost.exe");
> > >
> > > It gives the exception "File or assembly name RemoteObjHost.exe, or
one of
> > > its dependencies, was not found.".
> > >
> > > I have also tried to put all the assemblies in the same folder but
same
> > > exception.
> > >
> > > Can anybody help me?
> > >
> > > Thanks.
> >
> >
> >