我在我的應用程序中使用了azure服務管理REST API。我上傳了天藍色的管理證書,並在當地有一份副本。 我將認證保存在應用程序本身的單獨文件夾(AzureCertificate)中並引用該位置。 e.g:使用Azure REST API的管理證書
string certificatePath = Server.MapPath("~/AzureCertificate/") + certificateName;
X509Certificate2 certificate = new X509Certificate2(certificatePath);
AzureCertificate -- Folder name certificateName - MyCertificatieName.cer
它工作正常,當我運行該應用程序我的本地開發環境。但是當我在Azure網站上部署相同的錯誤時,我遇到了以下錯誤。
The remote server returned an error: (403) Forbidden
我這是怎麼發出請求
string uri = apiURL + subscriptionId + "/services/hostedservices";
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(uri);
X509Certificate2 certificate = new X509Certificate2(certificatePath);
req.ClientCertificates.Add(certificate);
req.Headers.Add("x-ms-version", "2009-10-01"); HttpWebResponse res =
(HttpWebResponse)req.GetResponse();
但在最後一行拋出上面說的異常(req.GetResponse())。
我們可以用這種方式使用管理證書嗎?
我的要求是開發一個應用程序,它使用Azure REST API並在Azure中進行部署。
您試圖訪問哪個apiurl? – 2014-09-30 17:03:27