473,382 Members | 1,341 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Remoting Questions

Hey

I have some more questions with regards to Remoting in .NET 2. I'm using TCP with the Binary formatter.

My solution consists of 4 projects:
- Class Library containing the server classes which Inherits MarshalByRefObject (ok, at this stage it only contains one class... but its gonna grow)
- Class Library containing common classes and interfaces that will be shared between all projects. This include interfaces for the server objects so the clients won't have to reference the server class library directly and serializable objects like UserInfo, etc.
- Console Application that will host the server classes. Will later convert this to a Windows Service
- Windows forms application that will serve as the user interface

Ok, so this setup works. I've created a login form on the client, a UserIdentity class and ISecurityManagement interface in the common class library and a SecurityManagement class on the server.
So my code looks basically like this:
When the app starts, the following code executes:

Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As ApplicationServices.StartupEventArgs) Handles Me.Startup

RemotingConfiguration.ApplicationName = "MyApplication"

Channels.ChannelServices.RegisterChannel(New Channels.Tcp.TcpChannel, True)

Dim strUrl As String = My.Settings.Protocol & "://" & My.Settings.Server & ":" & My.Settings.Port.ToString.Trim
'This basically translates to "tcp://10.0.0.11:1981'
My.Application.ServerUrl = strUrl

RemotingConfiguration.RegisterWellKnownServiceType (GetType(ISecurityManagement), _
strUrl & "/SecurityManagement.rem", _
WellKnownObjectMode.SingleCall)
LoginForm.ShowDialog()

End Sub

When the user clicks Login, the following code executes:

Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click

Dim args() As Object = Nothing
Try
Dim serverObj As ISecurityManagement = _
Activator.GetObject( GetType(CommonLib.ServerInterfaces.ISecurityManage ment), _
My.Application.ServerUrl & "/SecurityManagement.rem")

Dim Usr As CommonLib.Security.UserIdentity = ServerObj.Login(txtUsername.Text, txtPassword.Text)

MsgBox(Usr.ToString)
Me.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub
Ok, this works if I'm working on one computer as long as the Console Application / Service hosting the server components are running. The problem I have is that as soon as I copy the client exe with the CommonLib.dll over to another computer, it doesn't work. I get an error message when attempting to log on (the code in brown).
If the service / console application is not running, I get a connection error, which is great because it tells me the app is trying to connect to the correct location. This error obviously occurs on both computers.
If I do start the service / console app, the client located on my computer works fine. The client on the other computer gives me the error:
"The server has rejected the client credentials."
If I set the EnsureSecurity option to False when registering the channel (code marked in orange), the application freeze on that line and I either have to stop the service to raise an error or terminate the client app.
Any idea how I can fix this?
Next question. The line of code marked in Navy. The application works if I leave that line in or if I remove it either way. So what is the use to have that code there if it doesn't affect whether the app works or not?
Finally I have a question about which type of remoting objects would work best for my app.
Here are some details on my app:

The database and the components talking directly to the database will be located on the server. On the client side, the windows forms will be quite a large application that will communicate with the server components.
They will for instance, open the Training Module and there they will constantly be busy filtering training records, scheduling new training, cancelling training, etc. Almost for every action they take there will be call(s) made to the database.

Remoting will be done over TCP with a binary formatter.

So what would be the best way to create the server components?
SingleCall, connection to the database is created and opened each time a call is made to the object.
or
Singleton where one connection will be created for the application and Opened / Closed for each call.

I don't know too much about remoting at this stage so I don't know all my options. If someone has some suggestions, please post 'em.
Thanks

William
May 18 '07 #1
2 4687

I have an example at:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!122.entry

which you can download, and try on a client (local) and server (remote machine) as well.
I have some connection strings in the project.

Sorry, that's all the help I can offer right now.

"Wimpie van Lingen" <va********@bigfoot.comwrote in message news:eG**************@TK2MSFTNGP03.phx.gbl...
Hey

I have some more questions with regards to Remoting in .NET 2. I'm using TCP with the Binary formatter.

My solution consists of 4 projects:
- Class Library containing the server classes which Inherits MarshalByRefObject (ok, at this stage it only contains one class... but its gonna grow)
- Class Library containing common classes and interfaces that will be shared between all projects. This include interfaces for the server objects so the clients won't have to reference the server class library directly and serializable objects like UserInfo, etc.
- Console Application that will host the server classes. Will later convert this to a Windows Service
- Windows forms application that will serve as the user interface

Ok, so this setup works. I've created a login form on the client, a UserIdentity class and ISecurityManagement interface in the common class library and a SecurityManagement class on the server.
So my code looks basically like this:
When the app starts, the following code executes:

Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As ApplicationServices.StartupEventArgs) Handles Me.Startup

RemotingConfiguration.ApplicationName = "MyApplication"

Channels.ChannelServices.RegisterChannel(New Channels.Tcp.TcpChannel, True)

Dim strUrl As String = My.Settings.Protocol & "://" & My.Settings.Server & ":" & My.Settings.Port.ToString.Trim
'This basically translates to "tcp://10.0.0.11:1981'
My.Application.ServerUrl = strUrl

RemotingConfiguration.RegisterWellKnownServiceType (GetType(ISecurityManagement), _
strUrl & "/SecurityManagement.rem", _
WellKnownObjectMode.SingleCall)
LoginForm.ShowDialog()

End Sub

When the user clicks Login, the following code executes:

Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click

Dim args() As Object = Nothing
Try
Dim serverObj As ISecurityManagement = _
Activator.GetObject( GetType(CommonLib.ServerInterfaces.ISecurityManage ment), _
My.Application.ServerUrl & "/SecurityManagement.rem")

Dim Usr As CommonLib.Security.UserIdentity = ServerObj.Login(txtUsername.Text, txtPassword.Text)

MsgBox(Usr.ToString)
Me.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub
Ok, this works if I'm working on one computer as long as the Console Application / Service hosting the server components are running. The problem I have is that as soon as I copy the client exe with the CommonLib.dll over to another computer, it doesn't work. I get an error message when attempting to log on (the code in brown).
If the service / console application is not running, I get a connection error, which is great because it tells me the app is trying to connect to the correct location. This error obviously occurs on both computers.
If I do start the service / console app, the client located on my computer works fine. The client on the other computer gives me the error:
"The server has rejected the client credentials."
If I set the EnsureSecurity option to False when registering the channel (code marked in orange), the application freeze on that line and I either have to stop the service to raise an error or terminate the client app.
Any idea how I can fix this?
Next question. The line of code marked in Navy. The application works if I leave that line in or if I remove it either way. So what is the use to have that code there if it doesn't affect whether the app works or not?
Finally I have a question about which type of remoting objects would work best for my app.
Here are some details on my app:

The database and the components talking directly to the database will be located on the server. On the client side, the windows forms will be quite a large application that will communicate with the server components.
They will for instance, open the Training Module and there they will constantly be busy filtering training records, scheduling new training, cancelling training, etc. Almost for every action they take there will be call(s) made to the database.

Remoting will be done over TCP with a binary formatter.

So what would be the best way to create the server components?
SingleCall, connection to the database is created and opened each time a call is made to the object.
or
Singleton where one connection will be created for the application and Opened / Closed for each call.

I don't know too much about remoting at this stage so I don't know all my options. If someone has some suggestions, please post 'em.
Thanks

William
May 18 '07 #2
Ok... After LOOOONG research on the web, MSDN, newsgroups and posting on various VB forums and trying basically everything I could thought of, I found only one post that eventually put me on the right track to solve the error "The server has rejected the client credentials."
(the solution to my first problem) in the post below.

So, to save time for other people in the future, here it is:

1. In ControlPanel --AdministrativeTools --LocalSecuritySettings --
UserRightsAssignment, Add either 'Everyone' or 'AuthenticatedUsers' to the
'Access This Computer From The Network' Policy. (This might be what is
happening when a printer or folder is shared)

2. In ControlPanel --AdministrativeTools --LocalSecuritySettings --
SecurityOptions, Set the 'Network access: Sharing and security model for
local accounts' to 'classic - local users authenticate as themselves'. (I
think this solves the second issue. if this is not done then impersonation
and also 'protectionLevel' other than 'None' does not work.

3. If 'impersonate' is set to true on the server side, the
'tokenImpersonationLevel' on the client has to be 'Impersonation' or
'Delegation'.

In my case, I only did task 1 above (Only added AuthenticatedUsers) on the computer hosting the components and that sorted out my problem.
For the full post, you can go to http://www.hightechtalks.com/dotnet-...or-392988.html

Regards

Wimpie

"Wimpie van Lingen" <va********@bigfoot.comwrote in message news:eG**************@TK2MSFTNGP03.phx.gbl...
Hey

I have some more questions with regards to Remoting in .NET 2. I'm using TCP with the Binary formatter.

My solution consists of 4 projects:
- Class Library containing the server classes which Inherits MarshalByRefObject (ok, at this stage it only contains one class... but its gonna grow)
- Class Library containing common classes and interfaces that will be shared between all projects. This include interfaces for the server objects so the clients won't have to reference the server class library directly and serializable objects like UserInfo, etc.
- Console Application that will host the server classes. Will later convert this to a Windows Service
- Windows forms application that will serve as the user interface

Ok, so this setup works. I've created a login form on the client, a UserIdentity class and ISecurityManagement interface in the common class library and a SecurityManagement class on the server.
So my code looks basically like this:
When the app starts, the following code executes:

Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As ApplicationServices.StartupEventArgs) Handles Me.Startup

RemotingConfiguration.ApplicationName = "MyApplication"

Channels.ChannelServices.RegisterChannel(New Channels.Tcp.TcpChannel, True)

Dim strUrl As String = My.Settings.Protocol & "://" & My.Settings.Server & ":" & My.Settings.Port.ToString.Trim
'This basically translates to "tcp://10.0.0.11:1981'
My.Application.ServerUrl = strUrl

RemotingConfiguration.RegisterWellKnownServiceType (GetType(ISecurityManagement), _
strUrl & "/SecurityManagement.rem", _
WellKnownObjectMode.SingleCall)
LoginForm.ShowDialog()

End Sub

When the user clicks Login, the following code executes:

Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click

Dim args() As Object = Nothing
Try
Dim serverObj As ISecurityManagement = _
Activator.GetObject( GetType(CommonLib.ServerInterfaces.ISecurityManage ment), _
My.Application.ServerUrl & "/SecurityManagement.rem")

Dim Usr As CommonLib.Security.UserIdentity = ServerObj.Login(txtUsername.Text, txtPassword.Text)

MsgBox(Usr.ToString)
Me.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub
Ok, this works if I'm working on one computer as long as the Console Application / Service hosting the server components are running. The problem I have is that as soon as I copy the client exe with the CommonLib.dll over to another computer, it doesn't work. I get an error message when attempting to log on (the code in brown).
If the service / console application is not running, I get a connection error, which is great because it tells me the app is trying to connect to the correct location. This error obviously occurs on both computers.
If I do start the service / console app, the client located on my computer works fine. The client on the other computer gives me the error:
"The server has rejected the client credentials."
If I set the EnsureSecurity option to False when registering the channel (code marked in orange), the application freeze on that line and I either have to stop the service to raise an error or terminate the client app.
Any idea how I can fix this?
Next question. The line of code marked in Navy. The application works if I leave that line in or if I remove it either way. So what is the use to have that code there if it doesn't affect whether the app works or not?
Finally I have a question about which type of remoting objects would work best for my app.
Here are some details on my app:

The database and the components talking directly to the database will be located on the server. On the client side, the windows forms will be quite a large application that will communicate with the server components.
They will for instance, open the Training Module and there they will constantly be busy filtering training records, scheduling new training, cancelling training, etc. Almost for every action they take there will be call(s) made to the database.

Remoting will be done over TCP with a binary formatter.

So what would be the best way to create the server components?
SingleCall, connection to the database is created and opened each time a call is made to the object.
or
Singleton where one connection will be created for the application and Opened / Closed for each call.

I don't know too much about remoting at this stage so I don't know all my options. If someone has some suggestions, please post 'em.
Thanks

William
May 19 '07 #3

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

Similar topics

2
by: Dicky Cheng | last post by:
Hi, I am using .net remoting technology. I set up a .net remoting client and server in IIS. When the client calls the server, the server will run a long duration method (30-60seconds). I have a...
6
by: Guest | last post by:
Hi, I unerstand that if you choose IIS to host your .Net Remotingcomponents with HTTP channel and SOAP formatter, you get thebuilt-in security and configuraion features of IIS. Also we canexpose it...
4
by: Uchiha Jax | last post by:
Hello everyone, I am a plenty silly person who is trying to learn .NET remoting through trial and error (all articles I read are going over my head at the moment (mostly) so I thought i'd give...
1
by: miha.valencic | last post by:
Hi! What are the options for securing remote objects, which are accessible through IIS, when you have an application deployed on the same server, which uses custom Forms authentication? ...
9
by: Nak | last post by:
Hi there, I have been messing around with remoting in an attempt to create a "shared application" as mentioned in another thread by that name. I have created a singleton object just like the...
6
by: AMDRIT | last post by:
Hello folks, I appologize for the cross post, but I really need an answer on this: I do not think that I am seeing the whole picture here. I would like to create a windows service and a...
2
by: Ryan | last post by:
My apologies if this is not the forum to post questions regarding .NET Remoting, but I figured WebServices would be the most appropriate forum of the bunch. We're currently completely re-arching...
6
by: Palvinder Singh | last post by:
Hello google group peeps, I am new to remoting, but have a grasp of it. I am trying to create a server/client application, which will be deployed over an intranet. I have upwards of five...
7
by: hardieca | last post by:
Hi, Can anyone point me in the right direction for an example on how to use remoting to separate my BLL and DAL onto different tiers? Is there a best-practice pattern or design model for this? ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.