I’m using site manager to get the iis log’s file path in each instance, and upload them to the blob storage.
Here problem comes, in my project, there are two version of the services, the debug one and the online one, and I can only upload the iis log from service instance. To manage the project, I need to check the domain name to judgment the instance is in the online service, so that I can update in both debug and online services using the same code.
By now, here is my code:
SiteManager sm = new SiteManager();
foreach (var site in sm.Sites)
{
string[] logDir = GetIISLogDir(site);
foreach (string filePath in logDir)
{
UploadLogToStorage(filePath);
}
}
I think I need to obtain the domain name from variable site, and decide whether to upload the log.
You need to use the Get Deployment operation for this (REST API).
From within your instance you have access to the current deployment ID (
RoleEnvironment.DeploymentId). You can use this id when calling Get Deployment to get information about your current deployment like the deployment slot (prod/staging), the url…