示例#1
0
        static void Main(string[] args)
        {
            if (args.Count() != 2)
            {
                Console.WriteLine("******************************************************************************************************");
                Console.WriteLine("Usage");
                Console.WriteLine("PerfTestAppDeployer.exe PhysicalPath AppName");
                Console.WriteLine("Sample Usage");
                Console.WriteLine(@"PerfTestAppDeployer.exe C:\Source\Repos\AppDataCollection\Bin\Debug\APMC\Tests\FunctionalTests\TestApps\Aspx451\App MyAppName");
                Console.WriteLine("Please press enter key.....");
                Console.WriteLine(
                    "******************************************************************************************************");
                Console.Read();
            }
            else
            {
                string appLocation = args[0];
                string webSiteName = args[1];
                string poolName    = "PerfAppPool";
                int    port        = 9090;

                Console.WriteLine("" + appLocation + " " + webSiteName);

                try
                {
                    ACLTools.GetEveryoneAccessToPath(@appLocation);
                    IisApplicationPool applicationPool = new IisApplicationPool(poolName);
                    IisWebSite         iisWebSite      = new IisWebSite(webSiteName, @appLocation, port, applicationPool);

                    /*
                     * IisWebApplication iisWebApplication = new IisWebApplication(
                     *  "/" + webAppName,
                     *  @appLocation,
                     *  iisWebSite,
                     *  applicationPool);
                     */

                    Console.WriteLine("Application Deployed to IIS Successfully");
                    Console.WriteLine("ApplicationName:" + webSiteName);
                    Console.WriteLine("PhysicalPath:" + appLocation);
                }
                catch (Exception exception)
                {
                    Console.WriteLine("Failure" + exception);
                }
            }
        }
        /// <summary>The deploy.</summary>
        /// <param name="enableWin32Mode">The enable Win 32 Mode.</param>
        internal override void Deploy()
        {
            try
            {
                this.pool = new IisApplicationPool(this.AppName + "TestPool", enable32BitAppOnWin64: this.EnableWin32Mode);

                this.website = new IisWebSite(this.AppName + "TestSite", this.AppFolder, this.Port, this.pool);

                if (Directory.Exists(this.AppFolder))
                {
                    ACLTools.GetEveryoneAccessToPath(this.AppFolder);
                }
                else
                {
                    Trace.TraceWarning("AppFolder {0} do not exist.", this.AppFolder);
                }
            }
            catch (Exception ex)
            {
                Trace.TraceError("Exception occured while attempting to deploy application {0}: {1}. Tests will not continue as they are guaranteed to fail.", this.AppName, ex);
                throw;
            }
        }