Azure Functions核心工具中的动态代理? [英] Dynamic proxies in Azure Functions Core Tools?

查看:72
本文介绍了Azure Functions核心工具中的动态代理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mac上使用Azure Functions核心工具v2.3.148.我将其用于本地开发和发布我的应用程序.我的应用程序需要代理,因此我已经在proxies.json文件中定义了所有代理.在本地开发期间,Core Tools会识别文件,但会指向 到此处已硬编码的backUris(= Function App上的实际功能).因此,要解决此问题,我必须在手动进行本地开发之前更改backendUris.是否有任何方法可以自动执行此操作,或者可以在本地后端和实际后端之间轻松切换 功能?欢迎其他任何建议.

I'm using Azure Functions Core Tools v2.3.148 on my mac. I'm using it for local development and publishing my app. My app needs proxies, so I've defined all proxies in proxies.json file. During local development, Core Tools recognises the file but points to backendUris which are hardcoded there (=actual functions on Function App). So to fix the issue, I have to change backendUris before doing local development, manually. Is there any way to automate this or easily switch between local and actual backendUri  functions? Any other suggestion is welcomed.

推荐答案

在您的 proxies.json中使用 localhost 似乎是一种方法文件(如前所述) 这里.

There seems to be a way by using localhost in your proxies.json file as mentioned here.

您的 proxies.json 文件看起来像这样

{
  "


schema":"http://json.schemastore.org/proxies", 代理":{ "proxy1":{ "matchCondition":{ 方法":[获取"], 路线":"/api/test" }, "backendUri":"https://localhost/api/HttpTrigger" } } }
schema": "http://json.schemastore.org/proxies", "proxies": { "proxy1": { "matchCondition": { "methods": ["GET"], "route": "/api/test" }, "backendUri": "https://localhost/api/HttpTrigger" } } }

如果您的函数不是匿名函数,则可以使用函数键
1.直接在您的请求中,例如/api/test?code =< code>
2.在此JSON中, backendUri 类似于/api/HttpTrigger?code =< code>

If your function is not anonymous, you could either use your function key
1. Directly in your request like, /api/test?code=<code>
2. In this JSON, so backendUri will be like, /api/HttpTrigger?code=<code>


这篇关于Azure Functions核心工具中的动态代理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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