Exemplo n.º 1
0
 public Models.ResponseMessage.ResponseMessage CreateApplication(Application app)
 {
     Microsoft.Web.Administration.ServerManager iisWeb = new Microsoft.Web.Administration.ServerManager();
     iisWeb.Sites.Add(app.appName, "http", "*:80", app.appFolder);
     iisWeb.CommitChanges();
     Microsoft.Web.Administration.Site site = iisWeb.Sites[app.appName];
     site.Stop();
     site.ApplicationDefaults.ApplicationPoolName = pool;
     site.Start();
     iisWeb.CommitChanges();
     Models.ResponseMessage.ResponseMessage rm = new ResponseMessage.ResponseMessage();
     rm.type    = "success";
     rm.message = "Anwendung erfolgreich erstellt";
     return(rm);
 }
 public ResponseMessage.ResponseMessage CreateAppPool(ApplicationPool appPool)
 {
     try
     {
         bool checkAppPool = CheckAppPool(appPool);
         if (!checkAppPool)
         {
             ServerManager serverManager = new ServerManager();
             Microsoft.Web.Administration.ApplicationPool pool = serverManager.ApplicationPools.Add(appPool.applicationName);
             pool.Enable32BitAppOnWin64       = appPool.Enable32Bit;
             pool.ManagedPipelineMode         = (appPool.mode == "integrated " ? ManagedPipelineMode.Integrated : ManagedPipelineMode.Classic);
             pool.ManagedRuntimeVersion       = "v" + appPool.runTimeVersion;
             pool.Failure.RapidFailProtection = appPool.enableRapidFailure;
             serverManager.CommitChanges();
             Models.ResponseMessage.ResponseMessage rm = new ResponseMessage.ResponseMessage();
             rm.type    = "success";
             rm.message = "Anwendungspool erfolgreich erstellt";
             return(rm);
         }
         else
         {
             Models.ResponseMessage.ResponseMessage rm = new ResponseMessage.ResponseMessage();
             rm.type    = "error";
             rm.message = "Anwendungspool existiert bereits";
             return(rm);
         }
     }
     catch (Exception ex)
     {
         Models.Logger.Logger.CreateLogFile(ex.ToString());
         Models.ResponseMessage.ResponseMessage rm = new ResponseMessage.ResponseMessage();
         rm.type    = "error";
         rm.message = ex.ToString();
         return(rm);
     }
 }