简体   繁体   中英

Azure function API just returning 256 records

I have created Azure Function Api and this API returning random passwords. I am executing loop 4000 times and calling this API but this API just returning 256 random password and remaining as null...

I have executed same API code locally and it is working fine without function API so look like there is some limitation with Azure Functions.

Can someone please suggest if they encounter same issue or how can scale this up to get 4000+ records?

Please suggest...

This is what i have in my API

public static class HashPwd
{
    [FunctionName("HashPwd")]
    public static async Task<IActionResult> Run(
        [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req,
        ILogger log)
    {
        log.LogInformation("C# HTTP trigger function processed a request.");

        string name = req.Query["name"];

        string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
        dynamic data = JsonConvert.DeserializeObject(requestBody);
        name = RandomPassword(name); 

        string responseMessage = string.IsNullOrEmpty(name)
            ? "TempPassword"
            : $"{name}";

        return new OkObjectResult(responseMessage);
    }

    private static string RandomPassword(string name)
    {
        int lengthOfPassword = 8;
        string encyPassword = "";
        string valid = "abcdefghijklmnozABCDEFGHIJKLMNOZ1234567890!@#$%&";
        StringBuilder orgPasswordR = new StringBuilder();
        Random random = new Random();
        while (0 < lengthOfPassword--)
        {
            orgPasswordR.Append(valid[random.Next(valid.Length)]);
        }
        string orgPassword = orgPasswordR.ToString();
        return orgPassword;

    }

I find limits about Azure Function in this doc . 在此处输入图像描述

Please check your configurations(eg web.config) and set them up to a bigger number. Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM