internal ServerRemoteSession(PSSenderInfo senderInfo, string configurationProviderId, string initializationParameters, AbstractServerSessionTransportManager transportManager) { NativeCommandProcessor.IsServerSide = true; this._senderInfo = senderInfo; this._configProviderId = configurationProviderId; this._initParameters = initializationParameters; this._cryptoHelper = (PSRemotingCryptoHelperServer) transportManager.CryptoHelper; this._cryptoHelper.Session = this; this._context = new ServerRemoteSessionContext(); this._sessionDSHandler = new ServerRemoteSessionDSHandlerlImpl(this, transportManager); base.BaseSessionDataStructureHandler = this._sessionDSHandler; this._sessionDSHandler.CreateRunspacePoolReceived += new EventHandler<RemoteDataEventArgs>(this.HandleCreateRunspacePool); this._sessionDSHandler.NegotiationReceived += new EventHandler<RemoteSessionNegotiationEventArgs>(this.HandleNegotiationReceived); this._sessionDSHandler.SessionClosing += new EventHandler<EventArgs>(this.HandleSessionDSHandlerClosing); this._sessionDSHandler.PublicKeyReceived += new EventHandler<RemoteDataEventArgs<string>>(this.HandlePublicKeyReceived); transportManager.Closing += new EventHandler(this.HandleResourceClosing); transportManager.ReceivedDataCollection.MaximumReceivedObjectSize = 0xa00000; transportManager.ReceivedDataCollection.MaximumReceivedDataSize = null; }
internal ServerRemoteSession(PSSenderInfo senderInfo, string configurationProviderId, string initializationParameters, AbstractServerSessionTransportManager transportManager) { NativeCommandProcessor.IsServerSide = true; this._senderInfo = senderInfo; this._configProviderId = configurationProviderId; this._initParameters = initializationParameters; this._cryptoHelper = (PSRemotingCryptoHelperServer)transportManager.CryptoHelper; this._cryptoHelper.Session = this; this._context = new ServerRemoteSessionContext(); this._sessionDSHandler = new ServerRemoteSessionDSHandlerlImpl(this, transportManager); base.BaseSessionDataStructureHandler = this._sessionDSHandler; this._sessionDSHandler.CreateRunspacePoolReceived += new EventHandler <RemoteDataEventArgs>(this.HandleCreateRunspacePool); this._sessionDSHandler.NegotiationReceived += new EventHandler <RemoteSessionNegotiationEventArgs>(this.HandleNegotiationReceived); this._sessionDSHandler.SessionClosing += new EventHandler <EventArgs>(this.HandleSessionDSHandlerClosing); this._sessionDSHandler.PublicKeyReceived += new EventHandler <RemoteDataEventArgs <string> >(this.HandlePublicKeyReceived); transportManager.Closing += new EventHandler(this.HandleResourceClosing); transportManager.ReceivedDataCollection.MaximumReceivedObjectSize = 0xa00000; transportManager.ReceivedDataCollection.MaximumReceivedDataSize = null; }
/// <summary> /// This constructor instantiates a ServerRemoteSession object and /// a ServerRemoteSessionDataStructureHandler object. /// </summary> /// <param name="senderInfo"> /// Details about the user creating this session. /// </param> /// <param name="configurationProviderId"> /// The resource URI for which this session is being created /// </param> /// <param name="initializationParameters"> /// Initialization Parameters xml passed by WSMan API. This data is read from the config /// xml. /// </param> /// <param name="transportManager"> /// The transport manager this session should use to send/receive data /// </param> /// <returns></returns> internal ServerRemoteSession(PSSenderInfo senderInfo, string configurationProviderId, string initializationParameters, AbstractServerSessionTransportManager transportManager) { Dbg.Assert(null != transportManager, "transportManager cannot be null."); // let input,output and error from native commands redirect as we have // to send (or receive) them back to client for action. NativeCommandProcessor.IsServerSide = true; _senderInfo = senderInfo; _configProviderId = configurationProviderId; _initParameters = initializationParameters; #if !UNIX _cryptoHelper = (PSRemotingCryptoHelperServer)transportManager.CryptoHelper; _cryptoHelper.Session = this; #else _cryptoHelper = null; #endif Context = new ServerRemoteSessionContext(); SessionDataStructureHandler = new ServerRemoteSessionDSHandlerlImpl(this, transportManager); BaseSessionDataStructureHandler = SessionDataStructureHandler; SessionDataStructureHandler.CreateRunspacePoolReceived += HandleCreateRunspacePool; SessionDataStructureHandler.NegotiationReceived += HandleNegotiationReceived; SessionDataStructureHandler.SessionClosing += HandleSessionDSHandlerClosing; SessionDataStructureHandler.PublicKeyReceived += new EventHandler<RemoteDataEventArgs<string>>(HandlePublicKeyReceived); transportManager.Closing += HandleResourceClosing; // update the quotas from sessionState..start with default size..and // when Custom Session Configuration is loaded (during runspace creation) update this. transportManager.ReceivedDataCollection.MaximumReceivedObjectSize = BaseTransportManager.MaximumReceivedObjectSize; // session transport manager can receive unlimited data..however each object is limited // by maxRecvdObjectSize. this is to allow clients to use a session for an unlimited time.. // also the messages that can be sent to a session are limited and very controlled. // However a command transport manager can be restricted to receive only a fixed amount of data // controlled by maxRecvdDataSizeCommand..This is because commands can accept any number of input // objects transportManager.ReceivedDataCollection.MaximumReceivedDataSize = null; }