2017-03-12 9 views
0

次のコードはAzure Appサービスで実行するとAppデータを実行して取得します。 ローカルでは、証明書が許可されていないという例外がスローされます。 何らかの理由はありますか?Azure、コード.NETからアプリケーションサービスの詳細を取得

文字列からローカルに証明書を作成すると問題なく動作します。

public static CertificateCloudCredentials CredentialsProd; 
X509Store certStore = new X509Store(StoreName.My, StoreLocation.LocalMachine); 
certStore.Open(OpenFlags.ReadOnly); 


X509Certificate2Collection certCollection = certStore.Certificates.Find(
          X509FindType.FindByThumbprint, 
          prodThumbprint, 
          false); 

if (certCollection.Count > 0) 
{ 
    X509Certificate2 cert = certCollection[0]; 
    Credentials = new CertificateCloudCredentials(SUBSCRIPTION_ID, cert); 
} 
certStore.Close(); 


using (var client = new ComputeManagementClient(Credentials)) 
{  
    var t = client.HostedServices.GetDetailedAsync(serviceName, CancellationToken); 
         HostedServiceGetDetailedResponse detailedResponse = t.Result; 
} 

答えて

0

ローカルマシン上の証明書は.PFXそれはアズールでないだけのよう としてインストールする必要があります。

関連する問題