在Azure函数中获取流分析输出时出错 [英] Error in getting stream analytics output in Azure functions

查看:62
本文介绍了在Azure函数中获取流分析输出时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我正在使用温度传感器并将原始值发送到流中.我正在运行流分析作业,并将Azure功能配置为输出.但是我在运行azure函数时遇到编译错误.我正在从无线温度获取值 和湿度传感器我想解析Azure函数中的原始值,并将这些值转换为实际的温度和湿度.我该怎么办

I am using a temperature sensor and sending the raw values to the stream. I'm running a stream analytics job and configured Azure function as output. but I am getting compilation error while running azure function. I am getting the values from Wireless Temperature and Humidity Sensor  I want to parse the raw values in azure functions and convert those values into real temperature and humidity. How can I do it 

谢谢

using System;
using System.Net;
using System.Threading.Tasks;
using StackExchange.Redis;
using Newtonsoft.Json;
using System.Configuration;

public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
   log.Info($"C# HTTP trigger function processed a request. RequestUri={req.RequestUri}");
 
   // Get the request body
   dynamic dataArray = await req.Content.ReadAsAsync<object>();

   // Throw an HTTP Request Entity Too Large exception when the incoming batch(dataArray) is greater than 256 KB. Make sure that the size value is consistent with the value entered in the Stream Analytics portal.

   if (dataArray.ToString().Length > 262144)
   {        
      return new HttpResponseMessage(HttpStatusCode.RequestEntityTooLarge);
   }
   Log.Info(dataArray.ToString());
}
   


 


 

推荐答案

您在函数中缺少return语句-仅if条件具有return语句.无论如何都必须有一个return语句.

You are missing a return statement in your function - only the if condition has a return statement. There has to be a return statement in any case.

请告诉我这是否可以解决您的问题,否则我们可以继续进行调查.

Please let me know if this solves your problem or we can continue to probe in further.


这篇关于在Azure函数中获取流分析输出时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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