Programmatically I created the Website in IIS using the C# programming.
I want to update the created site following information
1. Replace the published files in Virtual directory.
2. IP Address.
3. Port Number.
4. AppPool Name.
5. AppPool Identity User Name.
6. AppPool Identity Password.
7. Runtime Version.
8. ManagedPipline Mode.
Please Help on this its very urgent task for me to complete.
MOHAMED JACKARIAHPosted Apr 2, 2015, 10:55 PM
Using the selected SiteName I am getting the site information from ServerManager. Here I am getting confusion how to update selected site information and settings.
public static bool UpdateWebSiteInfo(string siteName, int port, string RootPath, string AppPool, string FWVersion, string Pipe, string Binding, string SvrUsrId, string SvrPwd)
{
using (ServerManager sManager=new ServerManager())
{
// get site by Index or by siteName
Site ss = sManager.Sites[siteName];
// get appPool by Index or by appPoolName
ApplicationPool appPool = sManager.ApplicationPools[AppPool];
ss.Stop();
ss.ApplicationDefaults.ApplicationPoolName = appPool.Name;
foreach (var item in ss.Applications)
{
item.ApplicationPoolName = appPool.Name;
}
sManager.CommitChanges();
ss.Start();
appPool.Recycle();
}
return true;
}
I tried with above function getting the Object set to Instance exception.
Vithal WadjePosted Apr 2, 2015, 1:24 PM