C#-Azure函数:调用"HTTP触发器"时如何将消息记录到队列存储中.天蓝色功能? [英] C#-Azure function:How to log message to Queue storage when calling to "HTTP Trigger" azure function?

查看:105
本文介绍了C#-Azure函数:调用"HTTP触发器"时如何将消息记录到队列存储中.天蓝色功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#中使用"HTTP触发器"具有azure函数.当我使用"HTTP触发器"调用azure函数时,我想将消息记录到队列存储中.

I have a azure function with "HTTP Trigger" in C#. I want to log a message to queue storage when I invoke azure function with "HTTP trigger".

当"HTTP触发器"被调用时,它会在其他地方记录一条消息(log.info("C#Http trigger ....");),但我想将此日志消息与ipaddress一起使用(当用户向"HTTP触发器"功能)存储在队列存储中 (log.info("C#队列触发器",ipaddress)),这样我就可以一天封锁客户端ipaddress,如果用户对api的调用次数超过尝试次数,第二天我可以再次取消封锁客户端ipaddress,方法是从队列存储在云中运行计时器触发.

When "HTTP trigger" is invoked it logs a message (log.info("C# Http trigger....");) somewhere else but I want to this log message along with ipaddress, (when user makes request to "HTTP trigger" function) to be stored in Queue storage (log.info("C# Queue trigger ",ipaddress)) so that I can block client ipaddress for a day, if user makes calls to api beyond the number of attempts and next day again I can unblock client ipaddress by taking all ipaddress from queue storage running timer trigger in cloud.

是否有可能实现这一目标,否则除了队列存储之外,还有其他替代方法可以存储ipaddress吗?

Is there a possibility to achieve this or else Is there any alternate way to store ipaddress other than Queue storage?

推荐答案

您想为用户提供某种API并希望限制访问.为此,我宁愿建议使用Azure API管理( https://azure.microsoft.com/en-us/services/api-management/).它为您提供访问报价,该访问报价根据不同的条件限制用户对API端点的访问.它还提供了更多功能:用户管理,付款,订阅,安全性等等.

from what you wrote I would guess, that you want to offer some kind of API to your users and want to limit the access. To achieve this, I would rather suggest using Azure API Management (https://azure.microsoft.com/en-us/services/api-management/). It offers you a access quote, which limits the user's access to the API endpoint based on different criteria. It also offers much more: user management, payment, subscriptions, security and much more.

这篇关于C#-Azure函数:调用"HTTP触发器"时如何将消息记录到队列存储中.天蓝色功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆