azure-webjobs - Azure Web Job - 远程服务器返回 404

标签 azure-webjobs azure-webjobssdk

我有一个连续运行的 Web 作业,它监听一个 start 队列和一个停止 queue 及其各自的功能。 Web 作业中有 3 个预定义进程,start 队列包含一条消息,其中提到要启动的进程名称,而 stop 队列包含一条消息,其中提到进程名称停止。

自从过去 4 周以来,每当 webjob 停止进程时,它就会崩溃并重新启动并出现上述异常。

Executing: 'Functions.StartProcess' because New queue message detected on 'start'.
Updated the status of Process A to 1
Process A Started
Process A processed 200 records
Process A processed 200 records
Process A processed 200 records
Process A processed 200 records
Process A processed 200 records
Executing: 'Functions.StopProcess' because New queue message detected on 'stop'.
Process A stopped
Disposed Process A
Updated the status of Process A to 3

Unhandled Exception: Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an error: (404) Not Found. ---> System.Net.WebException: The remote server returned an error: (404) Not Found.
   at Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpResponseParsers.ProcessExpectedStatusCodeNoException[T](HttpStatusCode expectedStatusCode, HttpStatusCode actualStatusCode, T retVal, StorageCommandBase`1 cmd, Exception ex)
   at Microsoft.WindowsAzure.Storage.Blob.CloudBlobSharedImpl.<DeleteBlobImpl>b__1b(RESTCommand`1 cmd, HttpWebResponse resp, Exception ex, OperationContext ctx)
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndGetResponse[T](IAsyncResult getResponseResult)
   --- End of inner exception stack trace ---
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndExecuteAsync[T](IAsyncResult result)
   at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.EndDelete(IAsyncResult asyncResult)
   at Microsoft.WindowsAzure.Storage.Core.Util.AsyncExtensions.<>c__DisplayClass4.<CreateCallbackVoid>b__3(IAsyncResult ar)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.WebJobs.Host.Protocols.PersistentQueueWriter`1.<DeleteAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.WebJobs.Host.Loggers.CompositeFunctionInstanceLogger.<DeleteLogFunctionStartedAsync>d__e.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<TryExecuteAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.WebJobs.Host.Queues.Listeners.QueueTriggerExecutor.<ExecuteAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.WebJobs.Host.Queues.Listeners.QueueListener.<ProcessMessageAsync>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.Azure.WebJobs.Host.Timers.BackgroundExceptionDispatcher.<>c__DisplayClass1.<Throw>b__0()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

webjob 甚至不包含任何删除 blob 文件的代码。

调试时,调试器在抛出异常时没有指向任何特定行,因此我不知道真正的原因是什么。

PS :它以前运行完美,每个函数的主体都包含在 try catch block 中。 catch block 不会重新抛出异常,而只是记录堆栈跟踪并继续。

编辑

我必须检查下面的容器是否在那里

enter image description here

在 webjob 的存储中,还更新了 Microsoft.Web.WebJobs.Publish nuget 包。 我真的不确定这是否能解决问题

最佳答案

看起来您是对的,您确实需要手动创建 blob 容器,发布网络作业,在这种情况下,它看起来像环境将为您创建容器。

当我最初尝试时,我先进行了发布,而且效果非常好。第二个项目,我做的不同,所以我先运行控制台应用程序,它一直失败并显示 404。

因此,您需要创建:

  • azure-webjobs-仪表板
  • azure-webjobs-hosts
  • azure-jobs-hosts-archive
  • azure-jobs-hosts-output

希望对大家有帮助。

关于azure-webjobs - Azure Web Job - 远程服务器返回 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32756357/

相关文章:

azure - 将数据从 Azure Function Filter 传递到 Function

azure-webjobs - TimerTrigger 调度和代码执行时间

Azure Web 作业 - 使用不同配置访问不同的服务总线队列

.net - 调用 RunAndBlock 后是否可以将动态生成的函数绑定(bind)到 Azure WebJobs JobHost?

azure - 在 Azure 上部署 WebJob 时如何跟踪请求/响应

azure - 为什么 HttpClient PostAsJsonAsync 退出 Azure Web 作业而不运行其后的代码?

Azure Web作业 "Could not create SSL/TLS secure channel"

c# - 已找到 Azure WebJob,但计时器函数未执行

azure - 一个队列上有多个 Azure Webjob 实例

azure - 从 Azure 函数调用中枚举所有函数描述符