我有一个任务(我尝试使用worker角色并上传控制台应用程序并运行.exe),该任务应该每天运行一次并收集我的一些虚拟机的Azure Metrics.这在本地完美无缺,但在云服务上我得到此错误:
未处理的异常:Microsoft.WindowsAzure.CloudException:ForbiddenError:服务器无法验证请求.验证证书是否有效并与此订阅相关联.在Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSucces ...等
发生这种情况的路线是:
MetricDefinitionListResponse metricListResponse = metricsClient.MetricDefinitions.List(resourceId, null,
nspace);
Run Code Online (Sandbox Code Playgroud)
这是我的代码的一部分:
string subscriptionId = "fc4xxxx5-835c-xxxx-xxx-xxxxxxx";
// The thumbprint of the certificate.
string thumbprint = "?f5 b4 xxxxxxxx f7 c2";
// Get the certificate from the local store.
//X509Certificate2 cert = GetCertificate(StoreName.My, StoreLocation.LocalMachine, thumbprint);
//cert = GetCertificate(StoreName.My, StoreLocation.CurrentUser, thumbprint) ?? new X509Certificate2(("manageAzure.cer"));
var cert = new X509Certificate2(("manageAzure.cer"));
Console.WriteLine("Certificate is : " + cert);
// Create the metrics client.
var metricsClient = new MetricsClient(new CertificateCloudCredentials(subscriptionId, cert));
Console.WriteLine("metricsClient is : " + …Run Code Online (Sandbox Code Playgroud) 我有一个问题,希望你们能帮助我解决.
我有一个DbGeometry点(或DbGeography,我可以使用两者),我想检查它是否在DbGeometry Polygon(或者DbGeography)中.
我现在这样做:
var dbZones = new List<WasteManager.Database.Zone>();
foreach(var zone in zones)
{
var res = from z in DatabaseContext.Zones
let boundary =
!z.BoundaryGeometry.IsValid
? SqlSpatialFunctions.MakeValid(z.BoundaryGeometry)
: z.BoundaryGeometry
where z.ID == zone.ID && point.Within(boundary)
select z;
if(res.FirstOrDefault() != null) dbZones.Add(res.FirstOrDefault());
}
Run Code Online (Sandbox Code Playgroud)
所以我遍历区域(我的数据库的EF实体)并检查我的这一点是否在这个边界内.
问题是它没有返回任何结果,但我知道那个点在该边界内,因为我手动创建了边界,并且该点位于该边界内.
任何人都可以告诉我,如果有其他方法可以做到这一点或其他什么,我做错了什么?
非常感谢.
曼努埃尔