powershell - 本地 Azure 函数自动关闭
问题描述
我正在使用 VS Code 和 Azure Functions 扩展在 PowerShell 中构建 HTTP 触发器 Azure 函数。我已经能够让函数运行,我可以向它发送请求,但由于某种原因,恰好在 30 秒后,函数关闭了。以下是函数运行时似乎每次输出的内容
> Executing task: func host start <
%%%%%%
%%%%%%
@ %%%%%% @
@@ %%%%%% @@
@@@ %%%%%%%%%%% @@@
@@ %%%%%%%%%% @@
@@ %%%% @@
@@ %%% @@
@@ %% @@
%%
%
Azure Functions Core Tools (2.7.1585 Commit hash: 9a2b7239b937148e3b76e6f7999798629a82134a)
Function Runtime Version: 2.0.12641.0
[9/4/2019 14:47:37] Building host: startup suppressed:False, configuration suppressed: False
[9/4/2019 14:47:37] Initializing Host.
[9/4/2019 14:47:37] Host initialization: ConsecutiveErrors=0, StartupCount=1
[9/4/2019 14:47:37] LoggerFilterOptions
[9/4/2019 14:47:37] {
[9/4/2019 14:47:37] "MinLevel": "None",
[9/4/2019 14:47:37] "Rules": [
[9/4/2019 14:47:37] {
[9/4/2019 14:47:37] "ProviderName": null,
[9/4/2019 14:47:37] "CategoryName": null,
[9/4/2019 14:47:37] "LogLevel": null,
[9/4/2019 14:47:37] "Filter": "<AddFilter>b__0"
[9/4/2019 14:47:37] },
[9/4/2019 14:47:37] {
[9/4/2019 14:47:37] "ProviderName": "Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.SystemLoggerProvider",
[9/4/2019 14:47:37] "CategoryName": null,
[9/4/2019 14:47:37] "LogLevel": "None",
[9/4/2019 14:47:37] "Filter": null
[9/4/2019 14:47:37] },
[9/4/2019 14:47:37] {
[9/4/2019 14:47:37] "ProviderName": "Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.SystemLoggerProvider",
[9/4/2019 14:47:37] "CategoryName": null,
[9/4/2019 14:47:37] "LogLevel": null,
[9/4/2019 14:47:37] "Filter": "<AddFilter>b__0"
[9/4/2019 14:47:37] }
[9/4/2019 14:47:37] ]
[9/4/2019 14:47:37] }
[9/4/2019 14:47:37] FunctionResultAggregatorOptions
[9/4/2019 14:47:37] {
[9/4/2019 14:47:37] "BatchSize": 1000,
[9/4/2019 14:47:37] "FlushTimeout": "00:00:30",
[9/4/2019 14:47:37] "IsEnabled": true
[9/4/2019 14:47:37] }
[9/4/2019 14:47:37] SingletonOptions
[9/4/2019 14:47:37] {
[9/4/2019 14:47:37] "LockPeriod": "00:00:15",
[9/4/2019 14:47:37] "ListenerLockPeriod": "00:00:15",
[9/4/2019 14:47:37] "LockAcquisitionTimeout": "10675199.02:48:05.4775807",
[9/4/2019 14:47:37] "LockAcquisitionPollingInterval": "00:00:05",
[9/4/2019 14:47:37] "ListenerLockRecoveryPollingInterval": "00:01:00"
[9/4/2019 14:47:37] }
[9/4/2019 14:47:37] HttpOptions
[9/4/2019 14:47:37] {
[9/4/2019 14:47:37] "DynamicThrottlesEnabled": false,
[9/4/2019 14:47:37] "MaxConcurrentRequests": -1,
[9/4/2019 14:47:37] "MaxOutstandingRequests": -1,
[9/4/2019 14:47:37] "RoutePrefix": "api"
[9/4/2019 14:47:37] }
[9/4/2019 14:47:38] Starting JobHost
[9/4/2019 14:47:38] Starting Host (HostId=9s716j112276zf8-796082477, InstanceId=50750694-8516-4056-9c4e-25b05eed3725, Version=2.0.12641.0, ProcessId=10452, AppDomainId=1, InDebugMode=False, InDiagnosticMode=False, FunctionsExtensionVersion=)
[9/4/2019 14:47:38] Loading functions metadata
[9/4/2019 14:47:38] 1 functions loaded
[9/4/2019 14:47:38] Loading proxies metadata
[9/4/2019 14:47:38] Initializing Azure Function proxies
[9/4/2019 14:47:38] 0 proxies loaded
[9/4/2019 14:47:38] Starting language worker process:dotnet "C:\Users\<username>\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\powershell\Microsoft.Azure.Functions.PowerShellWorker.dll" --host 127.0.0.1 --port 50001 --workerId 91f57cdd-3cea-40cf-96da-5ff31d3b3854 --requestId c430cb96-2989-4e61-a64e-e7b339bad0bf --grpcMaxMessageLength 134217728
[9/4/2019 14:47:38] dotnet process with Id=18768 started
[9/4/2019 14:47:38] Generating 1 job function(s)
[9/4/2019 14:47:38] Found the following functions:
[9/4/2019 14:47:38] Host.Functions.newusername
[9/4/2019 14:47:38]
[9/4/2019 14:47:38] Host initialized (775ms)
[9/4/2019 14:47:38] Host started (794ms)
[9/4/2019 14:47:38] Job host started
Hosting environment: Production
Content root path: C:\powershell
Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.
Http Functions:
newusername: [GET,POST] http://localhost:7071/api/newusername
[9/4/2019 14:47:39] System Log: { Log-Level: Information; Log-Message: The enforced concurrency level (pool size limit) is '1'. }
[9/4/2019 14:47:39] System Log: { Log-Level: Trace; Log-Message: Custom pipe name specified. You can attach to the process by using vscode or by running `Enter-PSHostProcess -CustomPipeName AzureFunctionsPSWorker` }
[9/4/2019 14:47:43] Host lock lease acquired by instance ID '00000000000000000000000020C6A659'.
它坐在那里并响应对该地址的请求,但几乎正好 30 秒后它关闭了。我的问题是是否有人知道它为什么会自动关闭该功能以及如何阻止它这样做
我的 host.json 文件看起来像
{
"version": "2.0",
"managedDependency": {
"enabled": true
}
}
解决方案
推荐阅读
- jboss6.x - 为什么在 Silk Performer 中完成负载测试后 App 服务器内存没有释放?
- javascript - 为什么每次我用 simple-encryptor npm 运行加密时,它都会输出不同的结果
- android - 如何实现下图中提供的类似 facebook 的弹出窗口?尝试使用警报对话框
- javascript - 在引导程序 datetimepicker 3 上显示 24 小时制时钟
- wpf - 过滤 observablecollection (mvvm)
- c++ - 如何在给定四个点的情况下校准相机焦距、平移和旋转?
- url - 如何将编码的字符串传递给php中的url?
- dart - CircularProgressIndicator 不显示在颤振中
- php - 未在 eBay 重定向 URL 上获得响应代码
- reactjs - 重置redux-form时react-select不清除值