Пример #1
0
        public static void Attach()
        {
            // Get an instance of the currently running Visual Studio IDE.
            DTE2 dte2;
            dte2 = (DTE2)System.Runtime.InteropServices.Marshal.
            GetActiveObject("VisualStudio.DTE.10.0");

            var pa = new ProcessAttacher(dte2, "iisexpress", 10);
            pa.PessimisticAttachManaged();
        }
Пример #2
0
        static void Main()
        {
            Logger.Info(Process.GetCurrentProcess().Id);

            try
            {
                Thread.CurrentThread.Name = "Host";

                AppDomain.CurrentDomain.UnhandledException += ((s, e) => AppDomainException(e));
                AppDomain.CurrentDomain.ProcessExit += ProgramExited;
                AppDomain.CurrentDomain.DomainUnload += ProgramExited;
                System.Diagnostics.Process.GetCurrentProcess().Exited += ProgramExited;

                Config.ConfigureNlog();

                Logger.Info("Starting SharpNzb. Start-up Path:'{0}'", Config.ProjectRoot);

                IISController.KillOrphaned();
                IISController.StartIIS();

                System.Diagnostics.Process.Start(IISController.AppUrl);

#if DEBUG
                //Manually Attach debugger to IISExpress
                if (Debugger.IsAttached)
                {
                    try
                    {
                        ProcessAttacher.Attach();
                    }
                    catch (Exception e)
                    {
                        Logger.Warn("Unable to attach to debugger", e);
                    }

                }
#endif


            }
            catch (Exception e)
            {
                AppDomainException(e);
            }

            Console.Write("Press Enter At Any Time To Exit...");
            Console.ReadLine();
            IISController.StopIIS();
        }