IIS et la creation automatique d'une application web
je trouve pas au pose ma question .
j'ai question sur IIS ,
dans mon projet je suis amené a crée une application web ou web service .. sur IIS avec C# c'est a dire automatiquement avec le code.
dans ce stade ca va j'ai trouve la solution et ca roule comme H6 .
voila ma fonction (si vous avez d'autre solution plus convenable je suis sur écoute )
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
private void CreateApplicationInIIS(string name, string path)
{
string strSchema = "IIsWebVirtualDir";
string strRootSubPath = "/W3SVC/1/Root";
// you can specify any server name , "localhost" is for example
DirectoryEntry deRoot = new DirectoryEntry("IIS://" + "localhost" + strRootSubPath);
deRoot.RefreshCache();
DirectoryEntry deNewVDir = deRoot.Children.Add(name, strSchema);
deNewVDir.Properties["Path"].Insert(0, path);
deNewVDir.CommitChanges();
deRoot.CommitChanges();
// Create a Application
if (strSchema == "IIsWebVirtualDir")
deNewVDir.Invoke("AppCreate", true);
// Save Changes
deNewVDir.CommitChanges();
deRoot.CommitChanges();
deNewVDir.Close();
deRoot.Close();
} |
ma question ,
ec apres ma création de mon application IIS ,l' application sera tout de suite consultable ou je doit farce mon IIS a la mettre en marche actualise ou redemarrer ?
merci