Problem running commands on server from client

K

Kristian R.

Hi guys
I searched a lot, but i didn't found a solution, that fits.
So you are my last hope!

I've got the following Error:
A remote side security requirement was not fulfilled during authentication.
Try increasing the ProtectionLevel and/or ImpersonationLevel.

The error occurs when I registered a TcpChannel on client and server-side
and than the client tries to run something on the server.
I extracted my network-things from my project so it may be easier to help.
You can get it here:
www.krifi-ware.de/ngame/NetworkEngine.zip
(The TcpChannel at the server is created in "iniTCPChannel")

"Increasing the Protection and/or ImpersonationLevel" doesn't change
anything.
So, I hope you can help me.
Thanks.

(Adds: The Exception, the Code-Parts where the channel will be registered at
server and client side)

Here the complete exception without the assemblies:
************** Exception Text **************
System.Security.Authentication.AuthenticationException: A remote side
security requirement was not fulfilled during authentication. Try increasing
the ProtectionLevel and/or ImpersonationLevel. --->
System.ComponentModel.Win32Exception: The network logon failed
--- End of inner exception stack trace ---

Server stack trace:
at System.Net.Security.NegoState.ProcessAuthentication(LazyAsyncResult
lazyResult)
at
System.Net.Security.NegotiateStream.AuthenticateAsClient(NetworkCredential
credential, String targetName, ProtectionLevel requiredProtectionLevel,
TokenImpersonationLevel allowedImpersonationLevel)
at
System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.CreateAuthenticatedStream(Stream
netStream, String machinePortAndSid)
at
System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.CreateSocketHandler(Socket
socket, SocketCache socketCache, String machinePortAndSid)
at System.Runtime.Remoting.Channels.SocketCache.CreateSocketHandler(Socket
socket, String machineAndPort)
at
System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket(EndPoint
ipEndPoint)
at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket()
at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String
machinePortAndSid, Boolean openNew)
at
System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage
msg, ITransportHeaders requestHeaders, Stream requestStream)
at
System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage
msg, ITransportHeaders requestHeaders, Stream requestStream,
ITransportHeaders& responseHeaders, Stream& responseStream)
at
System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage
msg)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
at Interface.IServer.test(String msg, IClient cO)
at Client.Form1.btnSend_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button,
Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr
wparam, IntPtr lparam)

#################################################################################

Clientcode:
BinaryServerFormatterSinkProvider serverProv = new
BinaryServerFormatterSinkProvider();
BinaryClientFormatterSinkProvider clientProv = new
BinaryClientFormatterSinkProvider();
serverProv.TypeFilterLevel = TypeFilterLevel.Full;

IDictionary props = new Hashtable();
props["name"] = "netEngine.rem";
props["port"] = 10000;
props["typeFilterLevel"] = TypeFilterLevel.Full;

chan = new TcpChannel(props, clientProv, serverProv);
ChannelServices.RegisterChannel(chan, true);
remServer = (IServer)Activator.GetObject(typeof(IServer),
"tcp://" + "5.119.238.206" + ":"
+ "10000"
+ "/netEngine.rem");

cO = new ClientObject();



Servercode:
BinaryServerFormatterSinkProvider serverProv = new
BinaryServerFormatterSinkProvider();
BinaryClientFormatterSinkProvider clientProv = new
BinaryClientFormatterSinkProvider();
serverProv.TypeFilterLevel = TypeFilterLevel.Full;

IDictionary props = new Hashtable();
props["name"] = "netEngine.rem";
props["typeFilterLevel"] = TypeFilterLevel.Full;
props["port"] = 10000;

try { ChannelServices.UnregisterChannel(chan); }
catch (Exception) { }

chan = new TcpChannel(props,clientProv, serverProv);
ChannelServices.RegisterChannel(chan, true);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(srvProc),
"netEngine.rem", WellKnownObjectMode.Singleton);

sO = new srvProc();
obj = RemotingServices.Marshal(sO, "netEngine.rem");
 
N

Nicholas Paldino [.NET/C# MVP]

Kristian,

Are you trying to do this across two different machines in two different
domains, by chance? Where there isn't a trust relationship between the two
domains?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Kristian R. said:
Hi guys
I searched a lot, but i didn't found a solution, that fits.
So you are my last hope!

I've got the following Error:
A remote side security requirement was not fulfilled during
authentication. Try increasing the ProtectionLevel and/or
ImpersonationLevel.

The error occurs when I registered a TcpChannel on client and server-side
and than the client tries to run something on the server.
I extracted my network-things from my project so it may be easier to help.
You can get it here:
www.krifi-ware.de/ngame/NetworkEngine.zip
(The TcpChannel at the server is created in "iniTCPChannel")

"Increasing the Protection and/or ImpersonationLevel" doesn't change
anything.
So, I hope you can help me.
Thanks.

(Adds: The Exception, the Code-Parts where the channel will be registered
at server and client side)

Here the complete exception without the assemblies:
************** Exception Text **************
System.Security.Authentication.AuthenticationException: A remote side
security requirement was not fulfilled during authentication. Try
increasing the ProtectionLevel and/or ImpersonationLevel. --->
System.ComponentModel.Win32Exception: The network logon failed
--- End of inner exception stack trace ---

Server stack trace:
at System.Net.Security.NegoState.ProcessAuthentication(LazyAsyncResult
lazyResult)
at
System.Net.Security.NegotiateStream.AuthenticateAsClient(NetworkCredential
credential, String targetName, ProtectionLevel requiredProtectionLevel,
TokenImpersonationLevel allowedImpersonationLevel)
at
System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.CreateAuthenticatedStream(Stream
netStream, String machinePortAndSid)
at
System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.CreateSocketHandler(Socket
socket, SocketCache socketCache, String machinePortAndSid)
at System.Runtime.Remoting.Channels.SocketCache.CreateSocketHandler(Socket
socket, String machineAndPort)
at
System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket(EndPoint
ipEndPoint)
at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket()
at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String
machinePortAndSid, Boolean openNew)
at
System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage
msg, ITransportHeaders requestHeaders, Stream requestStream)
at
System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage
msg, ITransportHeaders requestHeaders, Stream requestStream,
ITransportHeaders& responseHeaders, Stream& responseStream)
at
System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage
msg)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
at Interface.IServer.test(String msg, IClient cO)
at Client.Form1.btnSend_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button,
Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)

#################################################################################

Clientcode:
BinaryServerFormatterSinkProvider serverProv = new
BinaryServerFormatterSinkProvider();
BinaryClientFormatterSinkProvider clientProv = new
BinaryClientFormatterSinkProvider();
serverProv.TypeFilterLevel = TypeFilterLevel.Full;

IDictionary props = new Hashtable();
props["name"] = "netEngine.rem";
props["port"] = 10000;
props["typeFilterLevel"] = TypeFilterLevel.Full;

chan = new TcpChannel(props, clientProv, serverProv);
ChannelServices.RegisterChannel(chan, true);
remServer = (IServer)Activator.GetObject(typeof(IServer),
"tcp://" + "5.119.238.206" + ":"
+ "10000"
+ "/netEngine.rem");

cO = new ClientObject();



Servercode:
BinaryServerFormatterSinkProvider serverProv = new
BinaryServerFormatterSinkProvider();
BinaryClientFormatterSinkProvider clientProv = new
BinaryClientFormatterSinkProvider();
serverProv.TypeFilterLevel = TypeFilterLevel.Full;

IDictionary props = new Hashtable();
props["name"] = "netEngine.rem";
props["typeFilterLevel"] = TypeFilterLevel.Full;
props["port"] = 10000;

try { ChannelServices.UnregisterChannel(chan); }
catch (Exception) { }

chan = new TcpChannel(props,clientProv, serverProv);
ChannelServices.RegisterChannel(chan, true);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(srvProc),
"netEngine.rem", WellKnownObjectMode.Singleton);

sO = new srvProc();
obj = RemotingServices.Marshal(sO, "netEngine.rem");
 
K

Kristian R.

Hi, sorry for the late answer:
Yes, this machines are in two different domains - they are in different
networks; connected by the internet.

Nicholas Paldino said:
Kristian,

Are you trying to do this across two different machines in two
different domains, by chance? Where there isn't a trust relationship
between the two domains?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Kristian R. said:
Hi guys
I searched a lot, but i didn't found a solution, that fits.
So you are my last hope!

I've got the following Error:
A remote side security requirement was not fulfilled during
authentication. Try increasing the ProtectionLevel and/or
ImpersonationLevel.

The error occurs when I registered a TcpChannel on client and server-side
and than the client tries to run something on the server.
I extracted my network-things from my project so it may be easier to
help. You can get it here:
www.krifi-ware.de/ngame/NetworkEngine.zip
(The TcpChannel at the server is created in "iniTCPChannel")

"Increasing the Protection and/or ImpersonationLevel" doesn't change
anything.
So, I hope you can help me.
Thanks.

(Adds: The Exception, the Code-Parts where the channel will be registered
at server and client side)

Here the complete exception without the assemblies:
************** Exception Text **************
System.Security.Authentication.AuthenticationException: A remote side
security requirement was not fulfilled during authentication. Try
increasing the ProtectionLevel and/or ImpersonationLevel. --->
System.ComponentModel.Win32Exception: The network logon failed
--- End of inner exception stack trace ---

Server stack trace:
at System.Net.Security.NegoState.ProcessAuthentication(LazyAsyncResult
lazyResult)
at
System.Net.Security.NegotiateStream.AuthenticateAsClient(NetworkCredential
credential, String targetName, ProtectionLevel requiredProtectionLevel,
TokenImpersonationLevel allowedImpersonationLevel)
at
System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.CreateAuthenticatedStream(Stream
netStream, String machinePortAndSid)
at
System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.CreateSocketHandler(Socket
socket, SocketCache socketCache, String machinePortAndSid)
at
System.Runtime.Remoting.Channels.SocketCache.CreateSocketHandler(Socket
socket, String machineAndPort)
at
System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket(EndPoint
ipEndPoint)
at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket()
at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String
machinePortAndSid, Boolean openNew)
at
System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage
msg, ITransportHeaders requestHeaders, Stream requestStream)
at
System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage
msg, ITransportHeaders requestHeaders, Stream requestStream,
ITransportHeaders& responseHeaders, Stream& responseStream)
at
System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage
msg)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
at Interface.IServer.test(String msg, IClient cO)
at Client.Form1.btnSend_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)

#################################################################################

Clientcode:
BinaryServerFormatterSinkProvider serverProv = new
BinaryServerFormatterSinkProvider();
BinaryClientFormatterSinkProvider clientProv = new
BinaryClientFormatterSinkProvider();
serverProv.TypeFilterLevel = TypeFilterLevel.Full;

IDictionary props = new Hashtable();
props["name"] = "netEngine.rem";
props["port"] = 10000;
props["typeFilterLevel"] = TypeFilterLevel.Full;

chan = new TcpChannel(props, clientProv, serverProv);
ChannelServices.RegisterChannel(chan, true);
remServer = (IServer)Activator.GetObject(typeof(IServer),
"tcp://" + "5.119.238.206" + ":"
+ "10000"
+ "/netEngine.rem");

cO = new ClientObject();



Servercode:
BinaryServerFormatterSinkProvider serverProv = new
BinaryServerFormatterSinkProvider();
BinaryClientFormatterSinkProvider clientProv = new
BinaryClientFormatterSinkProvider();
serverProv.TypeFilterLevel = TypeFilterLevel.Full;

IDictionary props = new Hashtable();
props["name"] = "netEngine.rem";
props["typeFilterLevel"] = TypeFilterLevel.Full;
props["port"] = 10000;

try { ChannelServices.UnregisterChannel(chan); }
catch (Exception) { }

chan = new TcpChannel(props,clientProv, serverProv);
ChannelServices.RegisterChannel(chan, true);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(srvProc),
"netEngine.rem", WellKnownObjectMode.Singleton);

sO = new srvProc();
obj = RemotingServices.Marshal(sO, "netEngine.rem");
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top