Azure 函数应用上的 routePrefix 被忽略

Ben*_*n H 6 azure azure-functions

我的函数应用程序似乎忽略了 routePrefix。它在控制台输出中显示正在成功读取配置文件:

info: Host.Startup[0]
      Host configuration file read:
      {
        "version": "2.0",
        "http": {
          "routePrefix": "",
          "maxOutstandingRequests": 20,
          "maxConcurrentRequests": 10,
          "dynamicThrottlesEnabled": false
        }
      }
[9/3/18 9:33:52 PM] Initializing Host.
[9/3/18 9:33:52 PM] Host initialization: ConsecutiveErrors=0, StartupCount=1
[9/3/18 9:33:52 PM] Starting JobHost
[9/3/18 9:33:52 PM] Starting Host (HostId=fractalnode-520849571, InstanceId=3e35830d-fd9d-4235-ae6a-7d1b356db04a, Version=2.0.12050.0, ProcessId=36292, AppDomainId=1, Debug=False, FunctionsExtensionVersion=)
[9/3/18 9:33:52 PM] Starting language worker process:node  "C:\Users\ben\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\node\dist/src/nodejsWorker.js" --host 127.0.0.1 --port 50880 --workerId 1f503d98-7661-4a40-83cd-ee19d9a48751 --requestId 9a6ef97a-b016-4554-904b-db43e3f4262c --grpcMaxMessageLength 134217728
[9/3/18 9:33:52 PM] node process with Id=36800 started
[9/3/18 9:33:52 PM] Generating 1 job function(s)
[9/3/18 9:33:52 PM] Found the following functions:
[9/3/18 9:33:52 PM] Host.Functions.serverTrigger
[9/3/18 9:33:52 PM]
[9/3/18 9:33:52 PM] Host initialized (196ms)
[9/3/18 9:33:52 PM] Host started (203ms)
[9/3/18 9:33:52 PM] Job host started
Hosting environment: Production
Content root path: c:\proj\directalert\www
Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.
Listening on http://0.0.0.0:7071/
Hit CTRL-C to exit...
Run Code Online (Sandbox Code Playgroud)

但是即使它应该是“”,它仍然具有 /api 前缀

Http Functions:
        serverTrigger: http://localhost:7071/api/{*segments}
Run Code Online (Sandbox Code Playgroud)

此外,将 routePrefix 更改为 '/' 或 '/apiprefixtest' 也没有任何区别。

知道为什么 Azure Functions 运行时会忽略 routePrefix 吗?

Roh*_*gal 12

我看到您使用的是 2.0 版。V2 的架构已更改,因此只需添加“扩展”,如下所示:

{
    "version": "2.0",
        "extensions": {
            "http": {
                "routePrefix": "",
                "maxOutstandingRequests": 20,
                "maxConcurrentRequests": 10,
                "dynamicThrottlesEnabled": false
            }
    }
} 
Run Code Online (Sandbox Code Playgroud)

V2 中有一些重大更改,因此请查看此文档,您可能会发现一些更相关的更改 -

Azure Functions Runtime 2.0.12050-alpha 重大更改通知

这是上面提到的特定于应用程序的文章中的链接 -

所有应用程序级扩展设置现在都位于“扩展”下