Willkommen bei dotnet-snippets.de! Snippet hinzufügen Login Registrieren
Snippets in der Datenbank: 1562 | Anzahl registrierter User: 1893 | Besucher online: 10
Hauptmenü
Home
Top Ten
Zufälliger Snippet
FAQs
.NET Community
dotnet-forum.de
dotnet-kicks.de
Social

RSS Feeds
Rss Alle Snippets
Rss C#
Rss VB.NET
Rss C++
Rss ASP.NET
Partner
Member of Microsoft Community Leader/Insider Program (CLIP)

IIS6: Neuen ApplicationPool anlegen


Autor: BrucklynBoy
Sprache: C#
Bewertung:
noch nicht bewertet
Anzahl der Aufrufe: 1693
  
Kick it on dotnet-kicks.de  

Beschreibung:

Legt einen neuen ApplikationPool an. Auf 64bit Systemen ermöglicht es die Ausführung von 32-bit APplikationen

Abgelegt unter: IIS, IIS6, ApplicationPool, Application Pool.



C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/// <summary>
///   Updated or creates the application pool for classic .net 4.
/// </summary>
/// <param name = "poolName">Name of the pool.</param>
public void SetPool(string poolName)
{
  using (var w3svc = new DirectoryEntry("IIS://localhost/W3SVC/AppPools"))
  {
    w3svc.RefreshCache();
    //if you want to assign existing application pool, get that
    Trace.WriteLine("getting app pool");
    var appPool = w3svc.Children.OfType<DirectoryEntry>().FirstOrDefault(child => poolName.Equals(child.Name, StringComparison.OrdinalIgnoreCase))
      ?? w3svc.Children.Add(poolName, "IIsApplicationPool");
    if (Environment.Is64BitOperatingSystem)
      appPool.InvokeSet("Enable32BitAppOnWin64", true);
    appPool.InvokeSet("AppPoolIdentityType", 2);
    appPool.InvokeSet("AppPoolState", 2);
    appPool.InvokeSet("Win32Error", 0);
    appPool.InvokeSet("AppPoolCommand", 1);
    appPool.CommitChanges();
  }
}

Sie haben Fragen zu diesem Snippet oder brauchen Hilfe bei der .NET Entwicklung?
Freundliche und kompetente Entwickler helfen Ihnen gern weiter im Forum für .NET Entwicklung.



Kommentare:
(Zum Schreiben von Kommentaren bitte anmelden.)



schlecht sehr gut
1 2 3 4 5 6 7 8 9 10
Nur angemeldete User können Snippets bewerten.