[lnkForumImage]
TotalShareware - Download Free Software

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


 

Chris B

6/11/2004 2:20:00 AM

I'm implementing a .NET remoting solution. I bought the book "Advanced .NET Remoting" by Ingo Rammer. Excellent book. I was able to successfully CAO remote my application (hosting works in a console app, a service, and IIS). So far so good.

Unfortunately, I've hit a snag that was not addressed in the book. I'm hoping someone will have an idea of how I can overcome this issue.

Here is the issue. Each time a user runs my application, I need to create a new process on the server to host the server-side portion of the application. This paradigm is different from the .NET remoting examples I have seen thus far. Each example seems to advocate one process on the server that serves multiple clients. This *one* process must be configured "statically" - i.e. one must set it up once (channel, port number, etc.) and then run it.

What I need to do is to "dynamically" create these processes as the client begins new sessions. As far as I can tell, IIS does not support this?

Here are a few ideas that I have:

1) Make my *one* server process a console server factory. Each time a client requests a new session, the client creates a reference to the server factory and calls a "CreateProcess" method. The server factory then creates a .NET remoting console server and passes back the reference to the client. The client goes about its business by invoking methods on the newly created server. These are the problems with this approach (as far as I can tell):

a) Each dynamically created process must be configured to a new port number.
b) How do I guarantee that the port number is unique?
c) Is there a good way of getting a port number dynamically?
d) Can I limit the range of port numbers?
e) Does this pose a security risk?
f) I would have to have custom code that would terminate the server process when the server object lifetime lease expires

2) Use IIS, but pre-define a set of ports and virtual diretories. Problems with this:

a) It's ugly. I will have to limit the number of ports to static virtual directories
b) I will have to copy the same server code into each virtual directory (ugly deployment)
c) I will still have to have a monitor server process that will direct a new client to an available virtual directory.

Does anyone have a better approach? Or can anyone answer my questions about dynamic port numbers?

I know some of you may be thinking "why is it necessary to create a new process for each client session". Let me assure that this is a necessary condition of the system that I am interfacing. I wish the system didn't have this limitation, but unfortunately it does.

Any help welcome. I'm running VS .NET 2003 (C#), Windows XP Pro, IIS

Thanks!


1 Answer

Sunny

6/11/2004 4:22:00 PM

0

Hi,

there is no way to to go without some dispatcher, which assignes to
every new client a new service.

Of the top of my head, I would try something like this:

Prepare your service (this one, which you want to start in a new process
every time) as IIS hosted, and put it in some dir, not under inetpub
\wwwroot, lets say c:\MyService.

Then, you have to figure out how programmatically to manipulate the IIS,
I''m sure there are SDKs and APIs for that.

Your listener service, when accepts a new client, creates in IIS a new
virtual directory, which points to C:\MyService, and gives it a new,
unique name. This dispatcher service also have to setup this virtual
directory''s application options to run at High isolation level, so it
will run in a separate process.

Then you pass the client the new url, and thats it. You do not need to
change the port, IIS will do the job.

You have to figure out when and how to delete that virtual directory,
when the client is done. I can think about in Applcation_End event to
notify the creator, and it will delete it the same way as it have
created it. Or you can implement some more aggressive approach as well.

Still, I can not figure out why you have these requirements, but ... we
live in a colorful world :)

Please, note that these are only a suggestions, but I''m curious, so
please, keep us informed about your progress.

Thanks
Sunny

In article <4995B54E-7FB0-47C1-A9FD-3053FA52CCC6@microsoft.com>, "=?Utf-
8?B?Q2hyaXMgQg==?=" <Chris B@discussions.microsoft.com> says...
> I''m implementing a .NET remoting solution. I bought the book "Advanced .NET Remoting" by Ingo Rammer. Excellent book. I was able to successfully CAO remote my application (hosting works in a console app, a service, and IIS). So far so good.
>
> Unfortunately, I''ve hit a snag that was not addressed in the book. I''m hoping someone will have an idea of how I can overcome this issue.
>
> Here is the issue. Each time a user runs my application, I need to create a new process on the server to host the server-side portion of the application. This paradigm is different from the .NET remoting examples I have seen thus far. Each example seems to advocate one process on the server that serves multiple clients. This *one* process must be configured "statically" - i.e. one must set it up once (channel, port number, etc.) and then run it.
>
> What I need to do is to "dynamically" create these processes as the client begins new sessions. As far as I can tell, IIS does not support this?
>
> Here are a few ideas that I have:
>
> 1) Make my *one* server process a console server factory. Each time a client requests a new session, the client creates a reference to the server factory and calls a "CreateProcess" method. The server factory then creates a .NET remoting console server and passes back the reference to the client. The client goes about its business by invoking methods on the newly created server. These are the problems with this approach (as far as I can tell):
>
> a) Each dynamically created process must be configured to a new port number.
> b) How do I guarantee that the port number is unique?
> c) Is there a good way of getting a port number dynamically?
> d) Can I limit the range of port numbers?
> e) Does this pose a security risk?
> f) I would have to have custom code that would terminate the server process when the server object lifetime lease expires
>
> 2) Use IIS, but pre-define a set of ports and virtual diretories. Problems with this:
>
> a) It''s ugly. I will have to limit the number of ports to static virtual directories
> b) I will have to copy the same server code into each virtual directory (ugly deployment)
> c) I will still have to have a monitor server process that will direct a new client to an available virtual directory.
>
> Does anyone have a better approach? Or can anyone answer my questions about dynamic port numbers?
>
> I know some of you may be thinking "why is it necessary to create a new process for each client session". Let me assure that this is a necessary condition of the system that I am interfacing. I wish the system didn''t have this limitation, but unfortunately it does.
>
> Any help welcome. I''m running VS .NET 2003 (C#), Windows XP Pro, IIS
>
> Thanks!
>
>
>