473,466 Members | 1,338 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Is it possible to instantiate an object in Bin folder of a web application remotly?

I have a console application in my local computer which I like to use
remoting in it,to instanciate an object (MyClass.dll) in a web
application(its bin folder) in a completely seperated box(in the same domain
thought) .I have two questions:

1)Is my case covered in "Remoting objects hosted in IIS" topic?Are they
same?

2) How should I authenticate to IIS from my console application? Do I really
need to authenticate to IIS before instantiating the object?
Thanks for your help.
Nov 19 '05 #1
14 1458
> 1)Is my case covered in "Remoting objects hosted in IIS" topic?Are
they same?
Not sure -- your description of the setup is a little unclear. Hosting remoting
objects out of IIS and ASP.NET means you've delpoyed your MarshalByRefObject-derived
classes to an assembly in the ~/bin and you've configured web.config to serve
those up as .rem or .soap endpoints. I'm not sure how your console app fits
into this picture unless it's the remoting client application.
2) How should I authenticate to IIS from my console application? Do I
really need to authenticate to IIS before instantiating the object?


Ah, so the console app is the client. So then on the transparent proxy you
can set the credentials via ((Thx to Mike Woodring for this tip)):

// assuming tp is your transparent proxy
IDictionary chanProps = ChannelServices.GetChannelSinkProperties(tp);
// this uses your client app's credentials
chanProps["credentials"] = CredentialCache.DefaultCredentials;
// or this sets them explicitlly if you have plaintext password
chanProps["credentials"] = new NetworkCredential(userName, password);

Ick. Super ick. Ick Ick Ick.

-Brock
DevelopMentor
http://staff.develop.com/ballen


Nov 19 '05 #2
> Not sure -- your description of the setup is a little unclear. Hosting
remoting objects out of IIS and ASP.NET means you've delpoyed your
MarshalByRefObject-derived classes to an assembly in the ~/bin and you've
configured web.config to serve those up as .rem or .soap endpoints. I'm
not sure how your console app fits into this picture unless it's the
remoting client application.


Yes,The class I want to uuse within the dll file is derived from
MarshalByRefObject and the assembly is in the bin folder of the web
application.The console application is an application which is going to
instantiate that class and uses one of its method to do something.The object
is hosting by IIS.I think having said this ,it means that console
application is remoting client app and IIS hosts the remote object.
Is that right? You mentioned web.config in your reply.which web config are
you refering to?

Let's assume all this done.I would always see the latest version of remote
object in my console app,right? and I do not need to reference it explicity
or be worried about compiling my client app whenevr they compile the
remoting object ,right?
Thanks for your reply.
"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:64**********************@msnews.microsoft.com ...
1)Is my case covered in "Remoting objects hosted in IIS" topic?Are
they same?


Not sure -- your description of the setup is a little unclear. Hosting
remoting objects out of IIS and ASP.NET means you've delpoyed your
MarshalByRefObject-derived classes to an assembly in the ~/bin and you've
configured web.config to serve those up as .rem or .soap endpoints. I'm
not sure how your console app fits into this picture unless it's the
remoting client application.
2) How should I authenticate to IIS from my console application? Do I
really need to authenticate to IIS before instantiating the object?


Ah, so the console app is the client. So then on the transparent proxy you
can set the credentials via ((Thx to Mike Woodring for this tip)):

// assuming tp is your transparent proxy
IDictionary chanProps = ChannelServices.GetChannelSinkProperties(tp);
// this uses your client app's credentials
chanProps["credentials"] = CredentialCache.DefaultCredentials;
// or this sets them explicitlly if you have plaintext password
chanProps["credentials"] = new NetworkCredential(userName, password);

Ick. Super ick. Ick Ick Ick.

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #3
> Let's assume all this done.I would always see the latest version of
remote object in my console app,right? and I do not need to reference
it explicity or be worried about compiling my client app whenevr they
compile the remoting object ,right?


As long as the client and server share some common metadata format, then
yes, this will work. The recommended approach is to use an interface as the
common metadata format. IOW, that's the shared API between the client and
server. This then will basically mean that your MBRO should be configured
as a WellKnown Object type. It's up to you whether you decide to configure
it as SingleCall or Singleton. Mind you, singleton is a misnomer. It just
means there's only evenr one instance at any one time, but it could be a
different instance over time.

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #4
> As long as the client and server share some common metadata format, then
yes, this will work


By this you mean the name of the method I'd like to call and also the
signature of it ,right?

I guess my other question is that ,you said "Bin folder" in your reply.I was
reading this article
(http://msdn.microsoft.com/library/de...ervicesiis.asp)
that I noticed the actual place for the remote objects needs to be in the
bin folder of the WWW root and those server side settings needs to be
inserted into the web.config file of IIS (wwwroot).Here is my problem:

Web portion of our application is in IIS and the object I'd like to remotely
call is always in the Bin folder of our application.I'd like to call that
object and I don;t want any body put the new version of that object to the
Bin folder of IIS whenever it gets changed.Is it possible to do that>
Thanks
"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:64**********************@msnews.microsoft.com ...
Let's assume all this done.I would always see the latest version of
remote object in my console app,right? and I do not need to reference
it explicity or be worried about compiling my client app whenevr they
compile the remoting object ,right?


As long as the client and server share some common metadata format, then
yes, this will work. The recommended approach is to use an interface as
the common metadata format. IOW, that's the shared API between the client
and server. This then will basically mean that your MBRO should be
configured as a WellKnown Object type. It's up to you whether you decide
to configure it as SingleCall or Singleton. Mind you, singleton is a
misnomer. It just means there's only evenr one instance at any one time,
but it could be a different instance over time.

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #5
> By this you mean the name of the method I'd like to call and also the
signature of it ,right?
Well, yeah, to compile your client you need to know what it is you're calling.
So the interface based approach is usually the best. Your client references
the assembly that has the interface definition (which is a seperate assembly
from the server itself) and then you get a proxy via RemotingServices.Connect
and cast it to your interface type.
I guess my other question is that ,you said "Bin folder" in your
reply.I was reading this article
(http://msdn.microsoft.com/library/de...ary/en-us/cpgu
ide/html/cpconhostingremoteobjectsininternetinformationserv icesiis.asp
) that I noticed the actual place for the remote objects needs to be
in the bin folder of the WWW root and those server side settings needs
to be inserted into the web.config file of IIS (wwwroot).Here is my
problem:

Web portion of our application is in IIS and the object I'd like to
remotely call is always in the Bin folder of our application.
The ~/bin folder is the bin folder under the root directory of your application
as configured in IIS as a virtual directory. You don't need to deploy it
at the root of the website (but you can).
I'd like
to call that object and I don;t want any body put the new version of
that object to the Bin folder of IIS whenever it gets changed.Is it
possible to do that>


To control what code is deployed into your web application you need to rely
upon standard NT security for that. Make it such that only admins can write
to the ~/bin folder.

-Brock
DevelopMentor
http://staff.develop.com/ballen


Nov 19 '05 #6
Brock,
Thanks for the nice reply.Your help is really appreciated.

The Bin folder that the actual remoting object resides is the bin folder of
a web application.This web application has a reference to a business logic
layer (which is a dll file ,I'd like to istantiate one of its class memebers
remotely).When they update the business logic layer ,they have to recompile
the Web application and automatically the Business logic layer dll file is
going to be written into the bin folder(the latest version) and by this
mechanism I always make sure that I'm using the latest version of remoting
object in my remoting client application.Dose it make sense?

By the way ,our web application is using NTLM(integrated windows) so I can
use what you wrote to authenticate to the remoting object and then I'm sure
no body else from outside world has access to the remote object.Am I right
here?
Thanks again

"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:64**********************@msnews.microsoft.com ...
By this you mean the name of the method I'd like to call and also the
signature of it ,right?


Well, yeah, to compile your client you need to know what it is you're
calling. So the interface based approach is usually the best. Your client
references the assembly that has the interface definition (which is a
seperate assembly from the server itself) and then you get a proxy via
RemotingServices.Connect and cast it to your interface type.
I guess my other question is that ,you said "Bin folder" in your
reply.I was reading this article
(http://msdn.microsoft.com/library/de...ary/en-us/cpgu
ide/html/cpconhostingremoteobjectsininternetinformationserv icesiis.asp
) that I noticed the actual place for the remote objects needs to be
in the bin folder of the WWW root and those server side settings needs
to be inserted into the web.config file of IIS (wwwroot).Here is my
problem:

Web portion of our application is in IIS and the object I'd like to
remotely call is always in the Bin folder of our application.


The ~/bin folder is the bin folder under the root directory of your
application as configured in IIS as a virtual directory. You don't need to
deploy it at the root of the website (but you can).
I'd like
to call that object and I don;t want any body put the new version of
that object to the Bin folder of IIS whenever it gets changed.Is it
possible to do that>


To control what code is deployed into your web application you need to
rely upon standard NT security for that. Make it such that only admins can
write to the ~/bin folder.

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #7
I know that for remoting application,I always need to have remote object dll
in the client side for the compilation to extract metadata of the object
,but I don;t know what you meant by interface -based approach.You mean that
I have to create an interface of the object in the server and implement it
in the remoting object to make sure they always adhere that interface and
the logic might be only changed.Is that what you meant?

Thanks
"Ray5531" <Ra****@microsft.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Brock,
Thanks for the nice reply.Your help is really appreciated.

The Bin folder that the actual remoting object resides is the bin folder
of a web application.This web application has a reference to a business
logic layer (which is a dll file ,I'd like to istantiate one of its class
memebers remotely).When they update the business logic layer ,they have to
recompile the Web application and automatically the Business logic layer
dll file is going to be written into the bin folder(the latest version)
and by this mechanism I always make sure that I'm using the latest version
of remoting object in my remoting client application.Dose it make sense?

By the way ,our web application is using NTLM(integrated windows) so I can
use what you wrote to authenticate to the remoting object and then I'm
sure no body else from outside world has access to the remote object.Am I
right here?
Thanks again

"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:64**********************@msnews.microsoft.com ...
By this you mean the name of the method I'd like to call and also the
signature of it ,right?


Well, yeah, to compile your client you need to know what it is you're
calling. So the interface based approach is usually the best. Your client
references the assembly that has the interface definition (which is a
seperate assembly from the server itself) and then you get a proxy via
RemotingServices.Connect and cast it to your interface type.
I guess my other question is that ,you said "Bin folder" in your
reply.I was reading this article
(http://msdn.microsoft.com/library/de...ary/en-us/cpgu
ide/html/cpconhostingremoteobjectsininternetinformationserv icesiis.asp
) that I noticed the actual place for the remote objects needs to be
in the bin folder of the WWW root and those server side settings needs
to be inserted into the web.config file of IIS (wwwroot).Here is my
problem:

Web portion of our application is in IIS and the object I'd like to
remotely call is always in the Bin folder of our application.


The ~/bin folder is the bin folder under the root directory of your
application as configured in IIS as a virtual directory. You don't need
to deploy it at the root of the website (but you can).
I'd like
to call that object and I don;t want any body put the new version of
that object to the Bin folder of IIS whenever it gets changed.Is it
possible to do that>


To control what code is deployed into your web application you need to
rely upon standard NT security for that. Make it such that only admins
can write to the ~/bin folder.

-Brock
DevelopMentor
http://staff.develop.com/ballen


Nov 19 '05 #8
> The Bin folder that the actual remoting object resides is the bin
folder of a web application.This web application has a reference to a
business logic layer (which is a dll file ,I'd like to istantiate one
of its class memebers remotely).When they update the business logic
layer ,they have to recompile the Web application and automatically
the Business logic layer dll file is going to be written into the bin
folder(the latest version) and by this mechanism I always make sure
that I'm using the latest version of remoting object in my remoting
client application.Dose it make sense?
Ok, sure. IOW, whenever they recompile evenrything and redeploy they're overwriting
what was there before. I can't tell if you're happy about that or not...
BTW, your MBRO doesn't need to be in the project where all of your ASPX pages
are (I assume you have some of those). It can be in its own assembly that
just has the remoting class. That organization is up to you.
By the way ,our web application is using NTLM(integrated windows) so I
can use what you wrote to authenticate to the remoting object and then
I'm sure no body else from outside world has access to the remote
object.Am I right here?


Just like any other web app, people from the outside world can try to get
to it. But barring some catastrophic security leak or hole, it sounds like
you're going to get the security you're looking for. But in order to to ensure
you've taken all the precautions you need I'd also suggest doing more research
beyond listening to some schmo on a newsgroup :)

-Brock
DevelopMentor
http://staff.develop.com/ballen


Nov 19 '05 #9
> I know that for remoting application,I always need to have remote
object dll in the client side for the compilation to extract metadata
of the object ,but I don;t know what you meant by interface -based
approach.You mean that I have to create an interface of the object in
the server and implement it in the remoting object to make sure they
always adhere that interface and the logic might be only changed.Is
that what you meant?


Your app needn't be designed that way. It sort of defeats the purpose to
require a copy of the server assembly at the client location. The interface
based approach is very similar, actually, because all the models require
metadata on the client so the runtime can instantiate a transparent proxy.

The interface based approach factors out into a seperate assembly all the
necessary information the client needs at compile time (and runtime). This
is then deployed to the client and that's used to compile. To connect, then,
RemotingServices.Connect(typeof(IInterfaceName), "protocol://server:port/app/endpoint")
is called to get a proxy that implements the interface. The server, of course,
must provide a class that implements the interface and is registered appropriately.
Like I said, it's not too different, but it's a bit cleaner, IMO, as it's
more explicit.

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #10
The interface based approach factors out into a seperate assembly all the
necessary information the client needs at compile time (and runtime). This
is then deployed to the client and that's used to compile. To connect,
then, RemotingServices.Connect(typeof(IInterfaceName),
"protocol://server:port/app/endpoint") is called to get a proxy that
implements the interface. The server, of course, must provide a class that
implements the interface and is registered appropriately.


I think we are both saying the same thing about the interface-based
approach.If you look at this
http://msdn.microsoft.com/library/de...stingInIIS.asp,
it is using almost the same idea.There is an IService interface which
defines everything.

You mean that I should make a seperate project (class Library) which
contains an interface of what I expect from the remote object and use that
deploy that interface to the client instead of Actual assembly ??? yes you
are right in that case, I don't need to have the actual assembly in the
client (As it is big assembly which is also the subject of daily changes)
and I only deploy the assembly which contains the interface,but having one
extra project for only one interface sucks in a way.Dosen't it? they have
put everything in Business Logic Layer.
Thanks

Nov 19 '05 #11
> I think we are both saying the same thing about the interface-based
approach.If you look at this
http://msdn.microsoft.com/library/de...ry/en-us/cpgui
de/html/cpconRemotingExampleHostingInIIS.asp, it is using almost the
same idea.There is an IService interface which defines everything.
Yeah, this is close. Except I don't advocate the use of "new" for remoting
objects. It leads to "sloppy thinking" for those who don't know that they're
working with remote objects.
You mean that I should make a seperate project (class Library) which
contains an interface of what I expect from the remote object and use
that deploy that interface to the client instead of Actual assembly
??? yes you are right in that case, I don't need to have the actual
assembly in the client (As it is big assembly which is also the
subject of daily changes) and I only deploy the assembly which
contains the interface,but having one extra project for only one
interface sucks in a way.Dosen't it? they have put everything in
Business Logic Layer.


Yes, I think a seperate project (assembly) is better as it's more explict.
Trying to take an existing library and "just remote it" leads to disaster,
as the library (set of classes and APIs) weren't designed for the remote
scenario. It's important to design for the task at hand. The business library
should do its thing, and the remoting layer should do another. It's very
hard to get both of those merged into a single API that works really well
for both masters (so to speak).

-Brock
DevelopMentor
http://staff.develop.com/ballen


Nov 19 '05 #12
Yeah, this is close. Except I don't advocate the use of "new" for remoting
objects. It leads to "sloppy thinking" for those who don't know that
they're working with remote objects.


This is what you advocate ? -->
RemotingServices.Connect(typeof(IInterfaceName),
"protocol://server:port/app/endpoint")
Thanks
Nov 19 '05 #13
> This is what you advocate ? -->
RemotingServices.Connect(typeof(IInterfaceName),
"protocol://server:port/app/endpoint")


Yes, except of course you'd want to substiture your interface name and the
URI for your particular server. And also you'd probabaly want to store the
URI in your client's config file and load it via ConfigurationSettings.AppSettings,
but other than that, yes. Mind you, this is the API for WellKnownObject configuration
and won't work with ClientActivatedObjects.

Is there something unappealing about this to you?

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #14
Brock ,

Your explanations where awesome and I learnt a lot.Thanks for your patience
and help.
"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:64**********************@msnews.microsoft.com ...
This is what you advocate ? -->
RemotingServices.Connect(typeof(IInterfaceName),
"protocol://server:port/app/endpoint")


Yes, except of course you'd want to substiture your interface name and the
URI for your particular server. And also you'd probabaly want to store the
URI in your client's config file and load it via
ConfigurationSettings.AppSettings, but other than that, yes. Mind you,
this is the API for WellKnownObject configuration and won't work with
ClientActivatedObjects.

Is there something unappealing about this to you?

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Martin Lucas-Smith | last post by:
Perhaps I'm using the wrong terminology, but is object delegation (as opposed to inheritance) possible?, i.e. the line $this->registration->displayStatus; in the example below. E.g. if...
6
by: Frank Millman | last post by:
Hi all I have a question regarding inheritance. I have come up with a solution, but it is not very elegant - I am sure there is a more pythonic approach. Assume the following class definitions....
8
by: Carel Lotz | last post by:
H We have ported our VB 6 application into VB .NET but are still integrating with a few COM + applications written in VB6 running on our application server (Win 2000 Server). We have the proxies...
0
by: jason | last post by:
i have classic ASP code that is calling a C# class library, which is wrapped for COM interop, and registered in the COM+ MMC. i have written 3 objects for the class library so far, and all three...
7
by: J-T | last post by:
I can instantiate my object in my *ASP.NET* application in two ways: A) public sealed class RSSingleton { private static ReportingServiceProxy m_RsProxy=null; static RSSingleton() {...
9
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
3
by: Steven W. Orr | last post by:
This is all an intro learning experience for me, so please feel free to explain why what I'm trying to do is not a good idea. In the Cookbook, they have a recipe for how to create global...
1
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
Hi, I have a user with lots of protected documents in a folder. Is it possible to create a small app which can be used to unprotect all the files in a folder on one click and then after all...
3
by: Peted | last post by:
I have an application with mdi parent form, and mutliple child forms. In the mdi parent form i want to instantiate a device class for comunicating to a peice of hardware via serial port. its...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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...
1
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...
0
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,...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.