我有一个连续运行的Web作业,它监听start
队列和停止queue
的各自功能。 Web作业中有3个预定义的进程,并且start
队列包含一条消息,其中提到要启动的进程名称,而stop
队列包含一条消息,其中提到要停止的进程名称。
当webjob停止进程时,它会崩溃并自最近4周以来以上述异常重新启动。
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块中。 catch块不会抛出异常,而只是记录堆栈跟踪并继续。
编辑
我必须检查以下容器是否在那里
在webjob的存储中,还更新了
Microsoft.Web.WebJobs.Publish
nuget包。我真的不确定这是否可以解决问题。 最佳答案
看起来您是对的,实际上您确实需要手动创建Blob容器或发布Web作业,在这种情况下,环境似乎会为您创建容器。
最初尝试该功能时,我先进行发布,而且效果非常诱人。第二个项目,我做的方式有所不同,因此我先运行了控制台应用程序,但由于404失败。
因此,您需要创建:
天蓝色webjobs仪表板
天蓝色webjobs主机
天蓝色工作主机存档
天蓝色工作主机输出
希望它能帮助某人。
关于azure-webjobs - Azure Web作业-远程服务器返回404,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32756357/