简体   繁体   English

如何让我的 Azure C# function 应用返回 json?

[英]How do I get my Azure C# function app to return json?

I have a function app which I run locally to test and all is fine我有一个 function 应用程序,我在本地运行它进行测试,一切正常

http://localhost:9999/api/DataFunction

This returns a json string no problem.这返回一个 json 字符串没问题。

However when I publish and connect to the url from Azure I just get the " Your Functions 4.0 app is up and running " page.但是,当我从 Azure 发布并连接到 url 时,我只看到“您的 Functions 4.0 应用程序已启动并正在运行”页面。

https://datafunctionxxxxxxxxxxxxx.azurewebsites.net/

The app has hard coded data as I am new to Function Apps and this was a test.该应用程序具有硬编码数据,因为我是 Function 应用程序的新手,这是一个测试。

What have I missed, do I need to do something else?我错过了什么,我需要做其他事情吗? I published from VS2022 to Azure with all the default settings.我使用所有默认设置从 VS2022 发布到 Azure。

Have you tried appending api/DataFunction on to the end of your URI:您是否尝试过将api/DataFunction附加到 URI 的末尾:

https://datafunctionxxxxxxxxxxxxx.azurewebsites.net/api/Datafunction

If you are using function level authentication then you will also have an authentication key as a query string.如果您使用 function 级别的身份验证,那么您还将拥有一个身份验证密钥作为查询字符串。

https://datafunctionxxxxxxxxxxxxx.azurewebsites.net/api/Datafunction&code=<keyhere>

You can obtain this from the Azure Portal您可以从 Azure 门户网站获取

获取函数地址

暂无
暂无

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

相关问题 如何让 C# Azure Function 与 Static Web App 配合使用? - How to make C# Azure Function work with Static Web App? Azure,我正在尝试通过二头肌向我的 function 应用程序添加功能,但不确定如何操作 - Azure, I'm trying to add fucntions to my function app via bicep but am unsure how to do so 如何读取 C# function 应用程序中的本地设置列表? - How do I read list of local settings in a C# function app? 从 Azure App Configuration Store 获取 Value,其中 content-type 在 C# 中设置为 application/json - Get Value from Azure App Configuration Store where the content-type is set to application/json in C# 如何将 json 文件(json 文件的路径)设置为 Azure 应用程序设置中的值? - How do I set json file(json file's path) to a value in Azure App settings? 如何在 C# 中使用 Fluent Validation 和 Azure Function 验证 JSON 对象的列表? - How to Validate a list of JSON Objects using Fluent Validation and Azure Function in C#? 如何获取连接到我的 azure webPubSub 的客户端数量? - How do I get the number of clients connected to my azure webPubSub? 如何在我的 Lambda Function 中使用带有回调返回步骤 Function 的 Heartbeat? - How do I use Heartbeat with a Callback Return Step Function in my Lambda Function? 在将 JSON 文件写入 AWS S3 存储桶后,如何让我的文件另存为 JSON - How do I get my file to be saved as JSON after writing a JSON file into AWS S3 bucket 如何从 C# 代码获取和设置 Azure 应用服务配置设置? - How to get and set Azure app service configuration settings from C# code?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM