I am having a unique problem with the Internet Information System.
I have several hosted websites. Each site contains an application pool and website. However, when they leave their paid status and expire. I developed a service to change the physical path websites .
Example:
private static void ExpireSite(string url)
{
using(ServerManaged manager = new ServerManager())
{
Site expire = manager.Sites[url];
expire.Applications[url].Path = @"C:\inetpub\wwwroot\Expired";
manager.CommitChanges();
}
}
It does not change the path, but I manage to get the Wrong path error .
The parameter urlcorresponds to the name and directory of the website in the IIS root folder.
I followed the Microsoft development network, but unfortunately the article does not describe this process very well.
Does anyone know if this is the right way to find the physical path? Is this MSDN article even accurate?
, :
private static void ExpireSite(string url)
{
using(ServerManaged manager = new ServerManager())
{
Site expire = manager.Sites[url];
expire.Applications[url].VirtualDirectories["/"].PhysicalPath = @"C:\inetpub\wwwroot\Expired";
manager.CommitChanges();
}
}
.
Update:
; -. :
using(ServerManager manager = new ServerManager())
{
Site domain = manager.Sites[url];
foreach(Application app in expire.Applications)
{
Console.WriteLine(domain.Id);
Console.WriteLine(domain.Name);
Console.WriteLine(app.Path);
}
}
, /. ; , :
domain.Applications[@"/"].VirtualDirectories[@"/"].PhysicalPath = @"C:\inetpub\wwwroot\Expired";
, /?