void OnDataReceived(FramingData data) { Uri uri = data.To; App app = appQueue.Lookup(uri); if (app == null) { // Not found return; } lock (ThisLock) { bool firstStart; app.EnsureStarted(out firstStart); if (firstStart) { WasHelper.OpenListenerChannelInstance(this.protocolHandle, app.AppPoolId, app.Instance.Id, app.Instance.Serialize()); } app.EnqueueAndDispatch(data); } }
protected override void OnClosing() { base.OnClosing(); // FUTURE: It would be nice if we close all listenerchannel instances for a graceful shutdown. // Otherwise WAS may terminate the worker process unexpected. WasHelper.UnregisterProtocol(protocolHandle); }
protected override void OnOpen(TimeSpan timeout) { initializedEvent.Reset(); WasHelper.RegisterProtocol(UdpConstants.Scheme, ref webHostCallbacks, out protocolHandle); initializedEvent.WaitOne(timeout, true); serviceHost = new ServiceHost(typeof(UdpControlService), new Uri(HostedUdpConstants.ControlServiceAddress)); // FUTURE: For security purpose, we need to set the right ACL to the Named-Pipe. Unfortunately // this is not supported in current WCF API. NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None); serviceHost.AddServiceEndpoint(typeof(IUdpControlRegistration), binding, ""); serviceHost.Open(); }