【发布时间】:2015-03-12 00:58:55
【问题描述】:
我正在尝试使用 Azure API 从 WinForms 应用程序将虚拟目录添加到 Azure 网站。我可以枚举我的网站空间中的网站,但我找不到允许我访问网站中的虚拟目录的方法。
这是我的代码:
string certPath = Properties.Settings.Default.AzureCertificatePath;
string certPassword = Properties.Settings.Default.AzureCertificatePassword;
string subscriptionId = Properties.Settings.Default.AzureSubscriptionId;
var cert = new X509Certificate2(certPath, certPassword, X509KeyStorageFlags.MachineKeySet);
var cred = new CertificateCloudCredentials(subscriptionId, cert);
using (var client = new WebSiteManagementClient(cred))
{
var spaces = client.WebSpaces.List();
foreach (var space in spaces)
{
Console.WriteLine("Space: {0}", space.Name);
var sites = client.WebSpaces.ListWebSites(space.Name, new WebSiteListParameters {PropertiesToInclude = { "Name" } }); ***// Where do I find out what properties can be included in this array?***
foreach (var site in sites)
{
***// What goes here to show the virtual directories in this specific website??????***
}
}
}
【问题讨论】:
-
对于那些晚于 OP 的人来说更多:
PropertiesToInclude导致库将propertiesToInclude添加到 API URL 中的 queryString 中,并且该查询字符串 什么都不做 -一点也不。截至 2016 年 4 月,.NET 库仍然严重过时,不应使用。