c# - Azure 函数上下文

标签 c# azure azure-functions

我希望在函数运行时使用 Microsoft.Azure.WebJobs.ExecutionContext 获取 InitationId,但是有没有办法在函数运行之外获取它实际的函数调用。

因此,如果调用类需要某种上下文,它可以使用它。可能吗?

最佳答案

当你运行一个函数时,你有 ExecutionContext

public static HttpResponseMessage Run(HttpRequestMessage req, TraceWriter log, ExecutionContext context)
{
    return req.CreateResponse(System.Net.HttpStatusCode.OK, context.InvocationId);
}

因此,如果您调用任何方法,您可能需要将此 id 路径传递给它。我不确定是否有任何类型的静态助手。

关于c# - Azure 函数上下文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46556031/

相关文章:

c# - 路径动画

c# - 使用 EF 从 Azure 移动服务检索父/子记录(包含列表的对象)

azure - TFS 部署到 Azure 错误 : cannot find ClientPerfCountersInstaller. exe

.net - 在azure函数应用程序启动时读取应用程序配置

c# - 我在 Azure Function Monitor 日志屏幕中看到条目。如何在 Application Insights 中找到它们?

azure-functions - 在 Azure Function 中添加自定义遥测属性

c# - 如何使用 XmlDocument 创建 XML 文档?

c# - Mono 没有找到 UIA Bridge,但是包已经安装了

c# - 如何强制 BusyIndi​​cator?

azure - 从 Azure AD 写回本地 AD : Creating users, 组等