Click here to Skip to main content
15,899,935 members

Comments by Mohamed Zackkariah (Top 1 by date)

Mohamed Zackkariah 2-Apr-15 22:54pm View    
I am getting the above mentioned updated information from user and i validate those information successfully. Also i created the method and pass all information to the function.

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.