Tag: azure

在Async方法中绑定到输出blob时,将Blob绑定到IAsyncCollector时出错

我试图在这篇文章之后绑定到Async方法中的blob输出: 如何将输出值绑定到我的异步Azure函数? 我有多个输出绑定,所以只返回不是一个选项 public static async Task Run(HttpRequestMessage req, IAsyncCollector collection, TraceWriter log) { if (req.Method == HttpMethod.Post) { string jsonContent = await req.Content.ReadAsStringAsync(); // Save to blob await collection.AddAsync(jsonContent); return req.CreateResponse(HttpStatusCode.OK); } else { return req.CreateResponse(HttpStatusCode.BadRequest); } } 我对blob的绑定是: { “bindings”: [ { “authLevel”: “function”, “name”: “req”, “type”: “httpTrigger”, “direction”: “in” }, { “name”: […]

通过Xamarin将video上传到Azure存储

我正在尝试将video文件上传到我的Azure存储帐户。 我已经使用了图像,但是尝试查看上传的video会显示“不支持video格式或MIME类型”的消息。 video格式为mp4。 我使用以下代码上传: public async Task UploadVideo(Stream video, string path) { var container = GetContainer(“videos”); // Creates the container if it does not exist await CreateContainer(container); //Gets the file extension string lastPart = path.Split(‘.’).Last(); // Uploads the video to the blob storage CloudBlockBlob videoBlob = container.GetBlockBlobReference(path); videoBlob.Properties.ContentType = “video/” + lastPart; await videoBlob.UploadFromStreamAsync(video); } […]

如何在没有登录的情况下使用window azure media server的文件路径阻止播放video?

目前在Windows Azure媒体服务上做一个项目基础。 场景 – 网站上有一个媒体播放器,播放媒体的video源文件包含在Azure媒体服务器上。 要求 – 1)未注册用户或没有登录用户无法使用azure媒体文件路径播放video 。 (不使用Active Directory凭据对我来说更好,如果我们可以上传该video加密格式并在用户登录时使用解密方式) 请提供符合上述要求的适当指导。 我们做了什么 – 如果我做错了,请通知我 1)尝试将媒体上传为加密格式并使用令牌但无法使用令牌访问权解密该video。 2)我认为,如果有一些机制,如会话变量维护azure媒体服务器,检查用户是否经过身份validation,然后授予访问权限,那么问题会解决吗? 但不知道如何使用它。 我已经阅读了许多文章/博客,经历了许多互联网可用的源代码但无法找到最佳方法。 或者接下来做什么?

Azure Native Application通用身份validation

我试图通过使用具有本机应用程序的公共端点为用户获取访问令牌。 我已经尝试将login.windows.net/common/OAuth2/Authorize和login.windows.net/common作为AuthenticationContext的权限。 这是我正在使用的function: authResult = authContext.AcquireToken(resource, clientID, redirectUri, PromptBehavior.Auto); 以下是我的应用程序的权限: Windows Azure Active Directory:以登录用户身份访问该目录 Windows Azure服务管理API:作为组织访问Azure服务管理 当我尝试并validation我能够登录时,但我得到错误: AADSTS65001:用户或管理员未同意使用ID为“{client ID}”的应用程序。 发送此用户和资源的交互式授权请求。 我可以使用以下方式登录: https://login.windows.net/ {tenantID} / OAuth2 /授权 但我希望用户能够登录而不知道他们的租户ID是什么。 感谢您的帮助。

上传时从video中抓取缩略图。 (Azure Blob存储)

我目前有一个系统可以将video上传到Azure blob存储并且工作正常。 我想实现一个function,在上传时抓取video中的缩略图,并将其推送到Azure。 我按照建议尝试使用它: new FFMpegConverter().GetVideoThumbnail(file, outputJPEG); 问题是我不知道什么用作outputJPEG,因为我没有写入的文件,而是想将该文件写入Azure的blob存储。 任何人都可以帮我解决这个问题,或者建议另一种方法吗? 我试过了: 创建一个新的空HttpPostedFileBase作为outputJPEG文件,但这是不可能的,因为它只接受用户上传的文件。 使用文件流,但这似乎不起作用,因为它需要写入的文件的位置,而不是让我只是推送到blob存储。 (来自:blob.UploadFromStream(file.InputStream);) 在此先感谢您的帮助!

如何更改服务总线队列的属性?

我正在使用服务总线队列在Web角色和工作者角色之间进行通信。 有时工作者角色不接受Web角色消息。 但它立即接受我发送的下一条消息。 所以我想也许它正在发生,因为批处理操作已启用。 我一直试图把它弄错,但我还没有成功。 这是我的代码。 public static QueueClient GetServiceBusQueueClient(string queuename) { string connectionString; if (RoleEnvironment.IsAvailable) connectionString = CloudConfigurationManager.GetSetting(“Microsoft.ServiceBus.ConnectionString”); else connectionString = ConfigurationManager.AppSettings[“Microsoft.ServiceBus.ConnectionString”]; var namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString); QueueDescription queue = null; if (!namespaceManager.QueueExists(queuename)) { queue = namespaceManager.CreateQueue(queuename); queue.EnableBatchedOperations = false; queue.MaxDeliveryCount = 1000; } else { queue = namespaceManager.GetQueue(queuename); queue.EnableBatchedOperations = false; queue.MaxDeliveryCount = 1000; […]

在Visual Studio中更改SQL Server数据库的最大大小以在Azure中上载

我在Visual Studio 2015中构建了一个小型ASP.NET MVC web application ,我想通过Microsoft Imagine Student订阅将其上传到Microsoft Azure。 当我尝试发布它时,我收到此错误: 失败:/subscriptions/1(…)4/resourceGroups/Default-ApplicationInsights-EastUS/providers/Microsoft.Sql/servers/sapromaniadbser/databases/Sap20170102030950_db()40619:版本’Free’不支持数据库最大大小’1073741824’。 很明显,我需要更改我的数据库最大大小,但我该怎么做呢? 在我在本地计算机上创建项目之后,我在Visual Studio Team Services创建了项目,并将其与Visual Studio Team Services的项目链接以进行版本控制。 我在Package Manager Console写了“enable-migrations”,我有了我的数据库。 所有资源都在同一资源组中。

KeyVault GetSecretAsync永远不会返回

在Web应用程序中使用KeyVault的示例代码中包含以下代码: public static async Task GetSecret(string secretId) { var secret = await keyVaultClient.GetSecretAsync(secretId); return secret.Value; } 我已将示例中包含的KeyVaultAccessor对象合并到我的应用程序中以进行测试。 该调用作为对我的一个web api控制器方法的查询的一部分执行: var secret = KeyVaultAccessor.GetSecret(“https://superSecretUri”).Result; 不幸的是,调用永远不会返回,查询将无限期地挂起…… 可能是什么原因,因为坦率地说我不知道​​从哪里开始……?

Azure ServiceBus在Client.Receive()上返回null

我有一个问题,从我在azure中设置的队列接收消息。 我以前使用相同的代码成功完成了这个,但现在我在尝试获取消息时只是为null。 当我在azure管理控制台中查看队列时,我清楚地看到队列包含5条消息。 这是代码: ServiceBus SB = new ServiceBus(); Microsoft.ServiceBus.Messaging.BrokeredMessage message; while (true) { message = SB.ReceiveMessage(“orders”); if (message == null) { break; } Procurement.Order order = message.GetBody(); order.id = Guid.NewGuid().ToString(); order.remindercount = 0; using (DbManager db = new DbManager()) { if (db.SetSpCommand(“CreateOrderHead”, db.Parameter(“@companyId”, order.companyId), db.Parameter(“@orderId”, order.orderId), db.Parameter(“@suppliercode”, order.suppliercode), db.Parameter(“@supplierorderId”, order.supplierorderId), db.Parameter(“@orderdate”, order.orderdate), db.Parameter(“@desireddate”, order.desireddate), […]

将Azure ServiceBus上的消息从.NET Core发送器发送到.NET 4.6处理程序

我想从.NET Core控制台应用程序通过Azure Service Bus发送消息,并在.NET 4.6控制台应用程序中接收它。 在.NET Core中,我使用Azure的新服务总线客户端作为发送者,但尚未用于生产(根据他们的自述文件)。 https://github.com/Azure/azure-service-bus-dotnet 我可以从.NET Core发送并使用示例轻松地使用.NET Core接收。 但是,当.NET 4.6应用程序订阅主题并收到相同的消息时,.NET 4.6应用程序会抛出此exception: Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: Functions.ProcessEvent System.InvalidOperationException: Exception binding parameter ‘message’ The BrokeredMessage with ContentType ‘string’ failed to deserialize to a string with the message: ‘Expecting element ‘string’ from namespace ‘http://schemas.microsoft.com/2003/10/Serialization/’.. Encountered ‘Element’ with name ‘base64Binary’, namespace http://schemas.microsoft.com/2003/10/Serialization/’. ‘ —> System.Runtime.Serialization.SerializationException: […]