[英]dotnet.exe fails to start when restarting Azure app service
We have several Azure app services live and I've ran into a consistent problem when restarting any of them.我们有几个 Azure 应用程序服务,在重新启动其中任何一个时我都遇到了一致的问题。
We've right-click -> Published from Visual Studio upto an existing instance of an App Service which brings it online and functional immediately, we can update and republish new code without a problem, but restarting to app service from Azure Portal doesn't launch dotnet.exe
.我们已右键单击 -> 从 Visual Studio 发布到应用服务的现有实例,使其立即联机并正常运行,我们可以毫无问题地更新和重新发布新代码,但从 Azure 门户重新启动应用服务不会启动dotnet.exe
。
When restarting or stopping/starting, the thread count instantly drops to 0 and continues to do nothing.重新启动或停止/启动时,线程数立即下降到 0 并继续无所作为。
I have to manually publish from VS again to reboot dotnet.exe
.我必须再次从 VS 手动发布以重新启动dotnet.exe
。
I can see that dotnet.exe
isn't an active process via Kudu -> Process Explorer
, and manually publishing up to the App Service and then refreshing the Process Explorer
list again shows that dotnet.exe
is now an active process and the App Service begins to function as expected.我可以通过Kudu -> Process Explorer
看到dotnet.exe
不是一个活动进程,手动发布到应用服务然后再次刷新Process Explorer
列表显示dotnet.exe
现在是一个活动进程和应用服务开始按预期运行。
Is there a way to prevent this, or at the very least debug why it's happening?有没有办法防止这种情况发生,或者至少调试它发生的原因?
As it turns out this is being caused by silent failures, outside of error handling I'd put in place.事实证明,这是由静默故障引起的,在我实施的错误处理之外。 IIS would spin up the associated processes but dotnet
would throw and error and "silently" die. IIS 会启动相关的进程,但dotnet
会抛出错误并“悄悄地”死掉。
I use quotes because I'd failed to utilise Azure's indepth logging, which hid the error message from plain view until switched on.我使用引号是因为我没有使用 Azure 的深入日志记录,它在打开之前从普通视图中隐藏了错误消息。
For some basic debugging steps:对于一些基本的调试步骤:
Open up your Kudu
console (Advanced Tools -> Go -> Debug Console) and navigate to LogFiles
, open up eventlog.xml
, the latest events are listed at the bottom.打开你的Kudu
控制台(Advanced Tools -> Go -> Debug Console)并导航到LogFiles
,打开eventlog.xml
,最新的事件列在底部。
Run dotnet myDll.dll
against your debug
folder locally, where myDll.dll
is the main dll
in your project.针对本地debug
文件夹运行dotnet myDll.dll
,其中myDll.dll
是项目中的主dll
。 This will typically throw the error causing dotnet
to exit out, which wasn't obvious at design time.这通常会抛出导致dotnet
退出的错误,这在设计时并不明显。
Ensure that your server-side appsettings.json
(or the associated appsettings.[development/release].json
contains the connection strings you're attempting to access.确保您的服务器端appsettings.json
(或关联的appsettings.[development/release].json
包含您尝试访问的连接字符串。
The errors that were occuring we'ren't due to design-time bugs, it generally fell over when trying to access run-time resources (such as appsettings
).我们发生的错误不是由于设计时错误,它通常在尝试访问运行时资源(例如appsettings
)时appsettings
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.