0
A
回答
0
要註冊域名,然後去,例如編程方法。我會建議 - 下面是代碼片段(C#),它將向webapp添加域。但是你可以使用http://portal.azure.com - Settings => Custom domains => Hostnames添加主機名。 (帶外部域)。
1)將NuGet Web Sites Management Package安裝到您的項目中。
2)獲取Azure發佈設置文件(例如,通過使用Powershell Get-AzurePublishSettingsFile)。您稍後需要(該文件內的管理證書字段的值)。
2)實例化WebSiteManagementClient。 That應該有助於理解代碼。
3)接下來,代碼如下。我剛剛測試過,它的工作原理。首先,它列出了網站空間,然後列出了每個網站空間內的網站,並且您應該將網站網站空間複製並粘貼到
public const string base64EncodedCertificate = "ManagementCertificateValueFromPublishSettingsFile";
public const string subscriptionId = "AzureSubscriptionId";
static SubscriptionCloudCredentials getCredentials()
{
return new CertificateCloudCredentials(subscriptionId, new X509Certificate2(Convert.FromBase64String(base64EncodedCertificate)));
}
static void Main(string[] args)
{
WebSiteManagementClient client = new WebSiteManagementClient(getCredentials());
WebSpacesListResponse n = client.WebSpaces.List();
n.Select(p =>
{
Console.WriteLine("webspace {0}", p.Name);
WebSpacesListWebSitesResponse websitesInWebspace = client.WebSpaces.ListWebSites(p.Name,
new WebSiteListParameters()
{
});
websitesInWebspace.Select(o =>
{
Console.Write(o.Name);
return o;
}).ToArray();
return p;
}).ToArray();
Console.ReadLine();
var configuration = client.WebSites.Get("WebSpaceName", "WebSiteName", new WebSiteGetParameters());
configuration.WebSite.HostNames.Add("new domain");
var resp = client.WebSites.Update("WebSpaceName", "WebSiteName", new WebSiteUpdateParameters() { HostNames = configuration.WebSite.HostNames });
Console.WriteLine(resp.StatusCode);
Console.ReadLine();
}
相關問題
- 1. 蔚藍上的WWW域
- 2. 重定向多個域同樣蔚藍的網站自定義參數
- 3. 設置自定義域和SSL
- 4. 問題在蔚藍
- 5. 蔚藍表存儲和Python
- 6. Azure blob的自定義域名SSL
- 7. 在角度應用程序中獲取蔚藍b2c自定義聲明
- 8. 選擇在蔚藍documentDB
- 9. 不能選擇在蔚藍
- 10. WSO2 API Manager如何配置自定義域和SSL
- 11. Heroku:同時使用herokuapp.com和自定義域名SSL的用戶
- 12. 查詢蔚藍分析服務與蔚藍的SQL數據庫
- 13. 重定向蔚藍流放置請求
- 14. 部署Web應用程序和蔚藍
- 15. 如何在自定義域Meteor應用上添加SSL?
- 16. 如何獲取從蔚藍
- 17. 蔚藍消費資源
- 18. 如何使用蔚藍
- 19. 錯誤創建與蔚藍
- 20. PHP與蔚藍數據庫
- 21. 從蔚藍的應用
- 22. 蔚藍轉化配置
- 23. 自動部署蔚藍雲服務 - 不在Visual Studio/VSTS中 -
- 24. Gcloud自定義域
- 25. 蔚藍的Web應用程序無法從蔚藍的工作 - 沒有錯誤
- 26. 加入蔚藍廣告B2C認證,以蔚藍的功能溫泉
- 27. 連接蔚藍RDS MySQL來蔚藍的web應用程序的WordPress博客
- 28. Google App Engine - 如何爲自定義域設置SSL
- 29. 自定義域名雲存儲上的SSL
- 30. SSL沒有被服務的AppEngine上的自定義(子)域