Viper
Member
I have a .NET remoting application that has been working on various networks and computers for a year now. However, we've installed the application on a brand new server (Windows Server 2003 R2) and all of the sudden, I get the error "The server has rejected the client credentials".
The Impersonation login credentials are stored in the config file. If the a username and password is stored, then the system automatically sets the tokenImpersonationLevel to "Impersonation". If no username and password are specified, it is set to "Delegation".
Now if I specify the username and password, I get the error mentioned above. If I leave it blank, it works fine. I only tested this on the server itself (loaded both the client and server components on the server). I have VPN access to the server and I'm not part of their domain so I cannot test if the Delegation works from an external pc.
As mentioned before, this system works basically everywhere. This is the first server that has caused this issue. Is there something that needs to be loaded on the server or something?
I checked the two Local Security Policy settings "Access this computer from a network" and "Network acess: Sharing and security model for local accounts" = Classic.
Herewith the code: Windows service on server
And herewith the client code connecting to the server:
The Impersonation login credentials are stored in the config file. If the a username and password is stored, then the system automatically sets the tokenImpersonationLevel to "Impersonation". If no username and password are specified, it is set to "Delegation".
Now if I specify the username and password, I get the error mentioned above. If I leave it blank, it works fine. I only tested this on the server itself (loaded both the client and server components on the server). I have VPN access to the server and I'm not part of their domain so I cannot test if the Delegation works from an external pc.
As mentioned before, this system works basically everywhere. This is the first server that has caused this issue. Is there something that needs to be loaded on the server or something?
I checked the two Local Security Policy settings "Access this computer from a network" and "Network acess: Sharing and security model for local accounts" = Classic.
Herewith the code: Windows service on server
VB.NET:
'Define a FormatterSinkProvider
Dim props As New Dictionary(Of String, Object)
props("typeFilterLevel") = "Full"
Dim tcpProvider As New BinaryServerFormatterSinkProvider(props, Nothing)
'Register a channel
props("secure") = True
props("impersonate") = True
' Register the channels
For Q As Integer = 0 To My.Settings.Channels.Count - 1
props("port") = My.Settings.Channels(Q).Port
props("name") = My.Settings.Channels(Q).ChannelName
Dim tcp As New Tcp.TcpChannel(props, Nothing, tcpProvider)
ChannelServices.RegisterChannel(tcp, True)
Next
' Register remoting classes
RemotingConfiguration.ApplicationName = "myAppName"
RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off
For C As Integer = 0 To My.Settings.Channels.Count - 1
For Q As Integer = 0 To My.Settings.ServerClasses.Count - 1
With My.Settings.ServerClasses(Q)
Dim entry As New WellKnownServiceTypeEntry(.ClassName, .ClassNamespace, My.Settings.Channels(C).Prefix & .Uri & My.Settings.Channels(C).Suffix, My.Settings.Channels(C).Mode)
RemotingConfiguration.RegisterWellKnownServiceType(entry)
End With
Next
Next
' Start listening for requests
For Q As Integer = 0 To My.Settings.Channels.Count - 1
CType(ChannelServices.GetChannel(My.Settings.Channels(Q).ChannelName), Channels.Tcp.TcpChannel).StartListening(Nothing)
Next
And herewith the client code connecting to the server:
VB.NET:
Dim props As New Hashtable()
props("typeFilterLevel") = "Full"
Dim provider As Channels.BinaryClientFormatterSinkProvider = New Channels.BinaryClientFormatterSinkProvider(props, Nothing)
props("secure") = True
props("protectionLevel") = System.Net.Security.ProtectionLevel.EncryptAndSign
If (My.Settings.Username <> "") AndAlso (My.Settings.Password <> "") Then
'Username and password supplied. Use it
props("tokenImpersonationLevel") = "Impersonation"
props("username") = My.Settings.Username
props("password") = My.Settings.Password
props("domain") = My.Settings.Domain
TChannel = New Channels.Tcp.TcpClientChannel(props, Nothing)
Else
'Create default Tcp channel
props("tokenImpersonationLevel") = "Delegation"
TChannel = New Channels.Tcp.TcpClientChannel(props, provider)
End If
Channels.ChannelServices.RegisterChannel(TChannel, True)