Commit 394fa3a7664e0671d8111ce867cf010c8c53d04a

Authored by Schwirg László
1 parent 41b2d68e

v1.7.2

- a web alkalmazás regisztrálása elvégzi a pool account beállítást is
Vrh.Log4Pro.MaintenanceConsole/Manager - WebApplicationManager.cs
... ... @@ -331,7 +331,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS
331 331 foreach (var p in sr.SelectedParameterList)
332 332 {
333 333 WebApplication wa=p.Parameters as WebApplication;
334   - WebApplicationManagerCore.RegisterWebApplication(wa.Xml_SiteName, wa.Xml_PoolName, wa.Xml_AppName, wa.Xml_AppPhysicalPath, wa.Xml_SitePhysicalPath, 8080, wa.Xml_RecreatePool, wa.Xml_RecreateSite, wa.Xml_RecreateApp, wa.Xml_PoolPipeLineMode,wa.Xml_VirtualDirectoryList);
  334 + WebApplicationManagerCore.RegisterWebApplication(wa.Xml_SiteName, wa.Xml_PoolName, wa.Xml_AppName, wa.Xml_AppPhysicalPath, wa.Xml_SitePhysicalPath, 8080, wa.Xml_RecreatePool, wa.Xml_RecreateSite, wa.Xml_RecreateApp, wa.Xml_PoolPipeLineMode,wa.Xml_VirtualDirectoryList,wa.Xml_PoolIdentitytype,wa.Xml_PoolUsername,wa.Xml_PoolPassword);
335 335 ColorConsole.WriteLine($"{wa.Xml_AppName} is registered in site {wa.Xml_SiteName} using pool {wa.Xml_PoolName}.");
336 336 }
337 337 return o;
... ... @@ -454,27 +454,26 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS
454 454 foreach (var p in sr.SelectedParameterList)
455 455 {
456 456 var wa = p.Parameters as WebApplication;
457   - GetPoolIdentityInfo(wa, out string username, out string password);
  457 + GetPoolIdentityInfo(wa, out string username, out string password, out ProcessModelIdentityType poolidentitytype);
458 458 if (username == "EX" || password == "EX") { return o; }
459 459 string olduserinfo = WebApplicationManagerCore.GetCurrentPoolIdentityInfo(wa);
460   - WebApplicationManagerCore.SetPoolUserAccount(wa.Xml_AppName, wa.Xml_SiteName, username, password);
  460 + WebApplicationManagerCore.SetPoolUserAccount(wa.Xml_AppName, wa.Xml_SiteName, username, password, poolidentitytype);
461 461 ColorConsole.WriteLine($"Pool identity changed for webapp {wa.Xml_AppName}.");
462 462 ColorConsole.WriteLine($"From '{olduserinfo}' to '{WebApplicationManagerCore.GetCurrentPoolIdentityInfo(wa)}'");
463 463 }
464 464 return o;
465 465 }
466   - private static void GetPoolIdentityInfo(WebApplication wa, out string username, out string password)
  466 + private static void GetPoolIdentityInfo(WebApplication wa, out string username, out string password,out ProcessModelIdentityType poolidentitytype)
467 467 {
468   - username = ""; password = "";
469 468 if (Menu.IsCommandMode())
470 469 {
471 470 username = wa.Xml_PoolName;
472 471 password = wa.Xml_PoolPassword;
  472 + poolidentitytype = wa.Xml_PoolIdentitytype;
473 473 }
474 474 else
475 475 {
476 476 var defaultinxml = WebApplicationManagerCore.GetDefaultPoolIdentityInfo(wa);
477   - username=""; password = "";
478 477 string olduserinfo = WebApplicationManagerCore.GetCurrentPoolIdentityInfo(wa);
479 478 ColorConsole.WriteLine($"Current user info: {olduserinfo}");
480 479 var un = $"Empty from XML={defaultinxml}.";
... ... @@ -485,12 +484,16 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS
485 484 ColorConsole.WriteLine($" (LSY) {nameof(ProcessModelIdentityType.LocalSystem)}");
486 485 ColorConsole.WriteLine($" (NSE) {nameof(ProcessModelIdentityType.NetworkService)}");
487 486 username = ColorConsole.ReadLine().ToUpper();
  487 + password = "";
  488 + poolidentitytype = ProcessModelIdentityType.SpecificUser;
488 489 if (username == "EX") { return; }
489   - else if (string.IsNullOrEmpty(username)) { username=wa.Xml_PoolUsername; password = wa.Xml_PoolPassword; }
490   - else if (username == "API" || username == nameof(ProcessModelIdentityType.ApplicationPoolIdentity)) { username = nameof(ProcessModelIdentityType.ApplicationPoolIdentity); }
491   - else if (username == "LSE" || username == nameof(ProcessModelIdentityType.LocalService)) { username = nameof(ProcessModelIdentityType.LocalService); }
492   - else if (username == "LSY" || username == nameof(ProcessModelIdentityType.LocalSystem)) { username = nameof(ProcessModelIdentityType.LocalSystem); }
493   - else if (username == "NSE" || username == nameof(ProcessModelIdentityType.NetworkService)) { username = nameof(ProcessModelIdentityType.NetworkService); }
  490 +
  491 + if (string.IsNullOrEmpty(username)) { username=wa.Xml_PoolUsername; password = wa.Xml_PoolPassword; }
  492 +
  493 + if (username == "API" || username == nameof(ProcessModelIdentityType.ApplicationPoolIdentity)) { username = ""; password = ""; poolidentitytype = ProcessModelIdentityType.ApplicationPoolIdentity; }
  494 + else if (username == "LSE" || username == nameof(ProcessModelIdentityType.LocalService)) { username = ""; password = ""; poolidentitytype = ProcessModelIdentityType.LocalService; }
  495 + else if (username == "LSY" || username == nameof(ProcessModelIdentityType.LocalSystem)) { username = ""; password = ""; poolidentitytype = ProcessModelIdentityType.LocalSystem; }
  496 + else if (username == "NSE" || username == nameof(ProcessModelIdentityType.NetworkService)) { username = ""; password = ""; poolidentitytype = ProcessModelIdentityType.NetworkService; }
494 497 else
495 498 {
496 499 ColorConsole.WriteLine("Enter password.[Enter]=finish input.Empty=no password.EX=exit");
... ... @@ -666,7 +669,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS
666 669 }
667 670  
668 671 #region private method:RegisterWebApplication
669   - public static void RegisterWebApplication(string sitename, string poolname, string appname, string poolphypath, string sitephypath, int siteport, bool recreatepool, bool recreatesite, bool recreateapp,ManagedPipelineMode plmode,List<WebApplication.VirtualDirectory> vdlist)
  672 + public static void RegisterWebApplication(string sitename, string poolname, string appname, string poolphypath, string sitephypath, int siteport, bool recreatepool, bool recreatesite, bool recreateapp,ManagedPipelineMode plmode,List<WebApplication.VirtualDirectory> vdlist,ProcessModelIdentityType poolidentitytype, string poolusername,string pooluserpassword)
670 673 {
671 674 using (ServerManager serverManager = new ServerManager())
672 675 {
... ... @@ -683,6 +686,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS
683 686 else if (recreateapp) { RemoveWebApp(serverManager, appname, sitename); CreateWebApp(serverManager, appname, poolname, sitename, poolphypath, vdlist); }
684 687  
685 688 CommitChanges(serverManager, poolname);
  689 + WebApplicationManagerCore.SetPoolUserAccount(appname, sitename, poolusername, pooluserpassword, poolidentitytype);
686 690 }
687 691 }
688 692 #endregion private method:RegisterWebApplication
... ... @@ -715,20 +719,44 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS
715 719 }
716 720 #endregion private method:SetImpersonateIdentity
717 721 #region private method:SetPoolUserAccount
718   - public static void SetPoolUserAccount(string appname, string sitename, string username, string password)
  722 + //public static void SetPoolUserAccountOLD(string appname, string sitename, string username, string password, ProcessModelIdentityType poolidentitytype)
  723 + //{
  724 + // using (var sm = new ServerManager())
  725 + // {
  726 + // //var pool = GetPool(GetPoolName(sitename, appname));
  727 + // var pool = GetPool(sm, sitename, appname);
  728 + // if (username == nameof(ProcessModelIdentityType.ApplicationPoolIdentity)
  729 + // || username == nameof(ProcessModelIdentityType.LocalService)
  730 + // || username == nameof(ProcessModelIdentityType.LocalSystem)
  731 + // || username == nameof(ProcessModelIdentityType.NetworkService))
  732 + // {
  733 + // pool.ProcessModel.UserName = null;
  734 + // pool.ProcessModel.Password = null;
  735 + // pool.ProcessModel.IdentityType = (ProcessModelIdentityType)Enum.Parse(typeof(ProcessModelIdentityType), username);
  736 + // }
  737 + // else // if (ProcessModelIdentityType.SpecificUser)
  738 + // {
  739 + // pool.ProcessModel.UserName = username;
  740 + // pool.ProcessModel.Password = password;
  741 + // pool.ProcessModel.IdentityType = ProcessModelIdentityType.SpecificUser;
  742 + // }
  743 + // CommitChanges(sm, pool.Name);
  744 + // }
  745 + //}
  746 + public static void SetPoolUserAccount(string appname, string sitename, string username, string password, ProcessModelIdentityType poolidentitytype)
719 747 {
720 748 using (var sm = new ServerManager())
721 749 {
722 750 //var pool = GetPool(GetPoolName(sitename, appname));
723 751 var pool = GetPool(sm, sitename, appname);
724   - if (username == nameof(ProcessModelIdentityType.ApplicationPoolIdentity)
725   - || username == nameof(ProcessModelIdentityType.LocalService)
726   - || username == nameof(ProcessModelIdentityType.LocalSystem)
727   - || username == nameof(ProcessModelIdentityType.NetworkService))
  752 + if (poolidentitytype == ProcessModelIdentityType.ApplicationPoolIdentity
  753 + || poolidentitytype == ProcessModelIdentityType.LocalService
  754 + || poolidentitytype == ProcessModelIdentityType.LocalSystem
  755 + || poolidentitytype == ProcessModelIdentityType.NetworkService)
728 756 {
729 757 pool.ProcessModel.UserName = null;
730 758 pool.ProcessModel.Password = null;
731   - pool.ProcessModel.IdentityType = (ProcessModelIdentityType)Enum.Parse(typeof(ProcessModelIdentityType), username);
  759 + pool.ProcessModel.IdentityType = poolidentitytype;
732 760 }
733 761 else // if (ProcessModelIdentityType.SpecificUser)
734 762 {
... ...
Vrh.Log4Pro.MaintenanceConsole/Properties/AssemblyInfo.cs
... ... @@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
32 32 // You can specify all the values or you can default the Build and Revision Numbers
33 33 // by using the '*' as shown below:
34 34 // [assembly: AssemblyVersion("1.0.*")]
35   -[assembly: AssemblyVersion("1.7.1.0")]
36   -[assembly: AssemblyFileVersion("1.7.1.0")]
  35 +[assembly: AssemblyVersion("1.7.2.0")]
  36 +[assembly: AssemblyFileVersion("1.7.2.0")]
... ...