简体   繁体   English

HttpRequest object 是 null 响应于 Azure Function

[英]HttpRequest object is null in response from Azure Function

This is my Azure function:这是我的 Azure function:

    [FunctionName("CreateItem")]
    public static async Task<IActionResult> Run(
        [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req, ILogger log)
    {
        string CompanyId = req.Query["CompanyId"];
        string Table = req.Query["Table"];
        string RowId = req.Query["RowId"];
        string Key = req.Query["Key"];
        string Action = req.Query["Action"];
        string Arg = req.Query["Arg"];

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

When I look at the requestBody objcet in runtime, it is null. Why Is that?当我在运行时查看 requestBody 对象时,它是 null。这是为什么?

Thank you James Gould and Kresten .谢谢James GouldKresten Posting your discussions as answer to help other community members.将您的讨论作为答案发布,以帮助其他社区成员。

The Actual request was not passing the body.实际请求没有传递正文。 Its just passing the query string.它只是传递查询字符串。 That's the reason why requestBody objcet in runtime is null这就是为什么 requestBody objcet 在运行时是 null 的原因

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Null 身体对来自 lambd 的 ALB 的反应 function - Null body response to ALB from lambd function 无法从 NodeJS 中的 Azure httpTriggered Function 获取响应数据 - Can not get the data in response from Azure httpTriggered Function in NodeJS 无法从 Azure Function 连接到 Azure Cosmos DB。 获取“Microsoft.Azure.Cosmos.Direct:Object 引用未设置为 object 的实例 - Unable to Connect from Azure Function to Azure Cosmos DB. Getting "Microsoft.Azure.Cosmos.Direct: Object reference not set to an instance of an object 在 Azure Function 应用程序中使用 HSTS 响应 header - Use HSTS response header in Azure Function app Firebase 实时数据库 onCall function 不从 remove() 操作返回响应数据 object - Firebase realtime database onCall function does not return a response data object from remove() operation 从另一个 Azure Function 呼叫 Azure Function - Calling Azure Function from another Azure Function Azure Function HttpClient 没有任何响应,不断重试 - Azure Function HttpClient doesn't give any response and keeps retrying 计时器触发 Azure function 活动。当前为 null - Timer triggered Azure function Activity.Current is null 从Azure数据工厂调用Azure Function报404错误 - Calling Azure Function from Azure Data Factory Gives 404 Error Azure Function 从 Azure devops 管道部署时无法访问运行时 - Azure Function Runtime Unreachable when deploying from Azure devops pipeline
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM