diff --git a/CoreRemoting/RemotingSession.cs b/CoreRemoting/RemotingSession.cs index a31600e..ab5ae79 100644 --- a/CoreRemoting/RemotingSession.cs +++ b/CoreRemoting/RemotingSession.cs @@ -427,6 +427,9 @@ private void ProcessRpcMessage(WireMessage request) { CurrentSession.Value = this; + if (_server.Config.AuthenticationRequired && !_isAuthenticated) + throw new NetworkException("Session is not authenticated."); + var service = _server.ServiceRegistry.GetService(callMessage.ServiceName); var serviceInterfaceType = _server.ServiceRegistry.GetServiceInterfaceType(callMessage.ServiceName); @@ -448,9 +451,6 @@ private void ProcessRpcMessage(WireMessage request) methodName: callMessage.MethodName); oneWay = method.GetCustomAttribute() != null; - - if (_server.Config.AuthenticationRequired && !_isAuthenticated) - throw new NetworkException("Session is not authenticated."); } catch (Exception ex) {