我有两个独立的 Azure Web 应用程序,每个应用程序都有一个连续运行的 Web 作业。将 C# 项目升级到 4.6.1 后,我将站点发布到 Azure,它们继续像 webjobs 一样工作。
我注意到配置有一个不同的 httpRuntime 版本来调试下面的版本,所以我更改了它们
<system.web>
<compilation debug="true" targetFramework="4.6.1" />
<httpRuntime targetFramework="4.5.1" maxRequestLength="30720" />
...
</system.web>
至
<system.web>
<compilation debug="true" targetFramework="4.6.1" />
<httpRuntime targetFramework="4.6.1" maxRequestLength="30720" />
...
</system.web>
发布网络应用程序和相应的网络作业后,它们仍然可以工作。
但是在更改 webjobs 应用程序配置后
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
</configuration>
至
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
每次我重新发布或停止并启动时,两个网络作业都会恢复为待启动状态。日志显示错误
[02/12/2016 19:48:35 > 686340: SYS INFO] Detected WebJob file/s were updated, refreshing WebJob
[02/12/2016 19:48:35 > 686340: SYS INFO] Status changed to Stopping
[02/12/2016 19:48:35 > 686340: SYS INFO] Status changed to Stopped
[02/12/2016 19:48:35 > 686340: SYS INFO] Status changed to Starting
[02/12/2016 19:48:35 > 686340: SYS INFO] Run script 'Timbo.Azure.Worker.exe' with script host - 'WindowsScriptHost'
[02/12/2016 19:48:35 > 686340: SYS INFO] Status changed to Running
[02/12/2016 19:48:35 > 686340: SYS ERR ] Job failed due to exit code -2146232576
[02/12/2016 19:48:35 > 686340: SYS INFO] Process went down, waiting for 60 seconds
[02/12/2016 19:48:35 > 686340: SYS INFO] Status changed to PendingRestart
[02/12/2016 19:49:36 > 686340: SYS INFO] Run script 'Timbo.Azure.Worker.exe' with script host - 'WindowsScriptHost'
[02/12/2016 19:49:36 > 686340: SYS INFO] Status changed to Running
[02/12/2016 19:49:36 > 686340: SYS ERR ] Job failed due to exit code -2146232576
[02/12/2016 19:49:36 > 686340: SYS INFO] Process went down, waiting for 60 seconds
[02/12/2016 19:49:36 > 686340: SYS INFO] Status changed to PendingRestart
错误代码-2146232576非常没有帮助,特别是因为我无法在谷歌或此处找到任何内容来查找它。
恢复此设置,一切都会恢复正常。所以我的问题是为什么会发生这种情况,以及为什么使用此设置在本地(开发计算机)运行的 webjob 可以工作,但在框架设置(在 appsettings 中)显示 .Net 版本 4.6 的网站内的 azure 上却不能工作
最佳答案
关于c# - Azure WebJobs 支持的 .Net Framework 版本吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35371522/