Tag: azure

使用RequireHttpsAttribute ASP.NET Core的HTTP错误310 ERR_TOO_MANY_REDIRECTS

我正在使用MVC在ASP.NET核心上构建一个应用程序。 我也在我的应用程序中使用Identity和Entity 7框架。 我正在Microsoft Azure上运行应用程序,该应用程序应附带HTTPS证书。 我正在使用此代码在我的Startup.cs中启用HTTPS services.AddMvc(options => { #if !DEBUG options.Filters.Add(new RequireHttpsAttribute()); #endif }); 我的问题是,当我访问网络应用程序时,我得到一个310 HTTP ERR_TOO_MANY_REDIRECTS响应。 我已经尝试清除我的cookie并将Web应用程序重新发布到Azure,但这些都没有成功。 当我禁用上面的代码时,我的应用程序在Azure上运行。 当我在浏览器中手动键入https://时,我得到一个安全的HTTPS连接。

未声明’AssemblyInfoFileMask’。 由于其保护级别,它可能无法访问

我正在创建一个自定义构建tfs活动,以便在azure持续集成中使用。 我使用了这个博客的代码: http : //www.ewaldhofman.nl/post/2010/06/01/Customize-Team-Build-2010-e28093-Part-10-Include-Version-Number-in-the -build-Number.aspx 正如您可以在其公共代码下面看到AssemblyInfoFileMask。 另外请检查截图,看看我的意思,BuildDetail它在同一个类,并没有显示蓝色图标中的错误。 我会在这里粘贴代码: [BuildActivity(HostEnvironmentOption.Controller)] public sealed class GetAssemblyVersion : CodeActivity { [RequiredArgument] public InArgument AssemblyInfoFileMask { get; set; } [RequiredArgument] public InArgument BuildDetail { get; set; } protected override string Execute(CodeActivityContext context) { // Obtain the runtime value of the input arguments string assemblyInfoFileMask = context.GetValue(this.AssemblyInfoFileMask); IBuildDetail buildDetail = […]

Service Fabric Actor实现多个接口的接口

我正在构建一个应用程序,其中我有多个不同的actor类型,它们对于某些不同的数据对象具有相同的行为(CRUD)。 为了更轻松地创建处理这个的代码,我试图创建一个接口,这些actor可以实现。 这意味着我有一个看起来像这样的actor接口: public interface IMyActor1 : IActor, IDataActor, IDataActor IDataActor如下: public interface IDataActor where T : IDataItem { Task Create(T item); Task Read(string itemId); Task Update(T item); Task Delete(string itemId); } 而自己的演员看起来像这样 class MyActor1: Actor, IMyActor1 { … } 最初我尝试从IActor派生IDataActor ,但可以理解这是不允许的,我得到一个“通用接口不能远程”。 我尝试部署时出错,所以我尝试了这个。 当我构建项目时,我得到以下错误日志: System.ArgumentException: The actor type ‘MyProject.ActorProject.MyActor1’ does not implement any actor interfaces. […]

支持HTTP和HTTPS Web.Config WCF服务

在尝试同时支持https和https时,我遇到了WCF服务的配置问题。 理想情况下,我想在我的开发机器上运行http,然后发布到运行https的azure。 我按照这些post尝试运行配置: http : //jayakrishnagudla.blogspot.com/2009/12/configuring-wcf-services-to-work-with.html 如何配置单个WCF服务以具有多个HTTP和HTTPS端点? 我的Web.Config如下: 据我所知,根据上面的链接,这个配置应该是正确的。 但是,当我通过http本地构建和运行此服务时,我收到以下错误: Could not find a base address that matches scheme https for the endpoint with binding WebHttpBinding. Registered base address schemes are [http]. 我不太清楚问题出在哪里,并假设它的配置错误。 任何帮助,将不胜感激。

服务结构中的配置转换?

当您通过Visual Studio创建一个空的Service Fabric应用程序时,项目模板将自动为您创建不同的配置文件,如Node1.XML,Node5.XML等。 我们更少关注节点数量而不是我们所针对的环境。 只有1个配置文件并从中创建转换,与Service Fabric建议相反吗? 例如,我们可能会有这样的事情: <!– ClusterConnectionParameters allows you to specify the PowerShell parameters to use when connecting to the Service Fabric cluster. Valid parameters are any that are accepted by the Connect-ServiceFabricCluster cmdlet. For a remote cluster, you would need to specify the appropriate parameters for that specific cluster. For example: Example […]

什么时候在azure色中创建一个块blob?

blob引用包含一个Properties属性,其LastModified为DateTimeOffset? 。 但是,我找不到blob的创建日期(时间)。 有没有我可以使用的标准API,或者我需要在meta中存储它? public async Task GetBlobMetaAsync(string blobId) { if (IsNullOrWhiteSpace(blobId)) throw new ArgumentException(“Value cannot be null or whitespace.”, nameof(blobId)); var blob = await EnsureGetBlobById(blobId); await blob.FetchAttributesAsync(); string clientBlobName; blob.Metadata.TryGetValue(BlobNameMetaKey, out clientBlobName); var length = blob.Properties.Length; var md5 = blob.Properties.ContentMD5; var lastModified = blob.Properties.LastModified.Value.ToUniversalTime().DateTime; var dateCreated= blob.Properties.???????; return new AzureBlobMeta(blobId, clientBlobName, length, md5, dateCreated); […]

在本地实现的Azurefunction在云中不起作用

我有以下function,我在本地定义,并能够正常调试它。 [FunctionName(“QueueTrigger”)] public static void DUMMYFUNCTION( [QueueTrigger(“myqueue”, Connection = “AzureWebJobsStorage”)]string myQueueItem, TraceWriter log) { log.Info($”C# function processed: {myQueueItem}”); } 在本地,“AzureWebJobsStorage”在local.settings.json文件中定义,以使用具有“myqueue”的存储帐户。 在Azure上的function设置中,“AzureWebJobsStorage”也设置为正确的连接字符串(与本地设置的字符串相同)。 这意味着,我没有像Azure中那样的问题没有在Azure中执行(无错误) 现在,我使用Visual Studio Team Service在git存储库中托管我的源代码。 我已将部署配置为使用源代码并部署其中包含的function。 我不认为该问题与VSTS有关,因为部署成功执行并且该function显示在我的function列表中: 部署之后,生成文件function.json并具有以下内容: { “generatedBy”: “Microsoft.NET.Sdk.Functions.Generator-1.0.8”, “configurationSource”: “attributes”, “bindings”: [ { “type”: “queueTrigger”, “connection”: “AzureWebJobsStorage”, “queueName”: “myqueue”, “name”: “myQueueItem” }], “disabled”: false, “scriptFile”: “../bin/myAssembly.dll”, “entryPoint”: “myAssembly.MyClass.DUMMYFUNCTION” } 问题是,当我在本地调试它时向队列中添加一个项目时,该函数会被执行,但是当该函数在azure上运行时它不会。 我需要在代码中进行哪些更改才能使其在azure上工作? […]

如何检查azure活动目录用户是否已处于批准状态

我创建了一个Azure活动目录用户,并将用户添加到了app角色。 现在我正在检索此用户并尝试将其添加到更多应用程序角色。 var activeDirectoryUser = client.Users.Where(u => u.UserPrincipalName == user.UserName).ExecuteSingleAsync().Result as User; 作为预防措施,我想在添加之前首先检查用户是否已经处于app角色,但问题是User对象上的ApproleAssignments字段始终为空。 即使您用户具有应用程序角色分配,如果我尝试将用户添加到相同的应用程序角色,我也会收到错误。 创建新的应用角色分配。 var appRoleAssignment = new AppRoleAssignment { Id = appRole.Id, ResourceId = Guid.Parse(servicePrincpal.ObjectId), PrincipalType = “User”, PrincipalId = Guid.Parse(user.ObjectId) }; if(IsUserInAppRole(user,appRoleAssignment))return; user.AppRoleAssignments.Add(appRoleAssignment); user.UpdateAsync().Wait(); 检查用户是否处于app角色。 private bool IsUserInAppRole(User user, AppRoleAssignment appRoleAssignment) { var userInApprole = user.AppRoleAssignments.Where(ara => ara.ObjectId == appRoleAssignment.Id.ToString()); return userInApprole.Any(); […]

访问Azure Service Fabric状态服务状态

我已将WebAPI添加到我的有状态服务器中,并希望从中访问StateManager (来自StatefulService类实现之外)。 最好的方法是什么? 目前我正在使用一个小类: internal static class InstanceAccessor { internal static StatefulService ActiveInstance { get; set; } } 并将值放在StatefulService RunAsync方法中: protected override async Task RunAsync(CancellationToken cancellationToken) { InstanceAccessor.ActiveInstance = this; …

Azure的EventData.PartitionKey如何决定写入哪个分区?

我正在尝试在Azure中实现事件中心。 我设法创建了一个生产者,它将消息发布到事件中心,以及一个消费者将其读取。 我的事件中心分为16个分区。 在消费者方面,我循环遍历以下各项: var eventHub = NamespaceManager.CreateFromConnectionString(builder.ToString()).GetEventHub(“de-analytics-events”); foreach (var partitionId in eventHub.PartitionIds) { subscriberGroup.RegisterProcessor(new Lease { PartitionId = partitionId }, new EventProcessorCheckpointManager()); Console.WriteLine(“Processing: ” + partitionId); } 在调试器中查看这些值表明,在16个分区的情况下, eventHub.PartitionIds范围从“0”到“15”。 但是,在生产者方面,我被允许指定的是我的EventData.PartitionKey ,它是一个字符串,但它不直接对应于消费者端的字符串。 例如,如果我指定了PartitionKey =“7”,则它不一定写入分区“7”。 阅读显示涉及某种哈希,但我并不特别想随机猜测16个字符串,这些字符串哈希到数字0-15。 所以我想知道如何定义发布到哪个分区? 为了补充参考, 这是我遵循的教程,以使我最简单的案例工作。