Beispiel #1
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }

            if (disposing && _server != null)
            {
                _server.Dispose();
                _server = null;
            }
            base.Dispose(disposing);
        }
Beispiel #2
0
 /// <summary>
 /// </summary>
 public void Dispose()
 {
     if (_server != null)
     {
         try
         {
             StopServer();
             _server.Dispose();
             _server = null;
         }
         catch
         {
         }
     }
 }
Beispiel #3
0
        private void Start()
        {
            // use CommandLineArguments as a pre validation tool

            CommandLineArguments args = GetArgs();

            ClearError();

            try
            {
                args.Validate();
            }

            catch (CassiniException ex)
            {
                SetError(ex.Field, ex.Message);
                return;
            }

            IPAddress = args.IPAddress;

            Port = args.Port;

            HostName = args.HostName;

            _server = new Server(args.Port, args.VirtualPath, args.ApplicationPath,
                                 System.Net.IPAddress.Parse(args.IPAddress), args.HostName, args.TimeOut, args.Ntlm,
                                 args.Nodirlist);

            if (args.AddHost)
            {
                HostsFile.AddHostEntry(_server.IPAddress.ToString(), _server.HostName);
            }

            try
            {
                _server.Start();
                _server.TimedOut += OnTimedOut;
                UpdateUIFromServer();
                InvokeSetRunState(RunState.Running);
            }

            catch (Exception ex)
            {
                SetError(ErrorField.None, ex.Message);
                _server.Dispose();
            }
        }
Beispiel #4
0
        private void Start()
        {
            // use CommandLineArguments as a pre validation tool

            CommandLineArguments args = GetArgs();
            ClearError();

            try
            {
                args.Validate();
            }

            catch (CassiniException ex)
            {
                SetError(ex.Field, ex.Message);
                return;
            }

            IPAddress = args.IPAddress;

            Port = args.Port;

            HostName = args.HostName;

            _server = new Server(args.Port, args.VirtualPath, args.ApplicationPath,
                                 System.Net.IPAddress.Parse(args.IPAddress), args.HostName, args.TimeOut, args.Ntlm,
                                 args.Nodirlist);

            if (args.AddHost)
            {
                HostsFile.AddHostEntry(_server.IPAddress.ToString(), _server.HostName);
            }

            try
            {
                _server.Start();
                _server.TimedOut += OnTimedOut;
                UpdateUIFromServer();
                InvokeSetRunState(RunState.Running);

            }

            catch (Exception ex)
            {
                SetError(ErrorField.None, ex.Message);
                _server.Dispose();
            }
        }