https://docs.microsoft.com/en-us/azure/azure-functions/functions-manually-run-non-http
我试图手动触发在2.0中创建并在.net core 2.0中开发的Azure Timer函数应用。
当我尝试访问该网址时,出现403错误。
我通过的答案 0 :(得分:2)
答案 1 :(得分:0)
我在针对服务总线触发的Azure Functions的集成测试中使用以下类。
<div id="app">
<Shop
:active-tab="activeTab"
@showProductModal="handleShowProductModal"
>
</Shop>
</div>
然后,您必须以将内容放置在“输入”对象中的格式发送数据。
class AzureFunctionCaller
{
private readonly HttpClient _httpClient;
private readonly string _functionUri;
public AzureFunctionCaller(string functionName)
{
_httpClient = new HttpClient();
_httpClient.DefaultRequestHeaders.Add("x-functions-key","<Key>");
_functionUri = $"<FUNCTION_ENDPOINT>/admin/functions/{functionName}";
}
public async Task CallViaAdminEndpoint(string content)
{
var httpContent = new StringContent(content, Encoding.UTF8, "application/json");
var response = await _httpClient.PostAsync(_functionUri, httpContent);
var responseContent = await response.Content.ReadAsStringAsync();
Console.WriteLine($"Response content: {responseContent}");
}
}
为解释input属性,以下是邮递员中相同呼叫的外观: