Microsoft.WindowsAzure.Storage: 服务器遇到内部错误但未告知根本原因

Microsoft.WindowsAzure.Storage: Server encountered an internal error without telling the root cause

我在本地用蓝铜创建了一个 Blob 存储容器,我可以用 Storarge Explorer write/delete 个文件。

此代码开始正常,但在查看几秒钟后结束,出现未处理的异常

using System.IO;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;


namespace WatchStorage
{
    #region Constructor
    public class WatchStorageFunctions
    {
        private ILogger Logger { get; set; }
       
        public WatchStorageFunctions(ILogger<WatchStorageFunctions> logger)
        {
            this.Logger = logger;
        }
        #endregion

        [FunctionName("TaskWatchWebjobs")]
         public void RunTaskWatchWebjobs([BlobTrigger("azuritstore/{name}", Connection = "AzureWebJobsStorage")]Stream myBlob, string name)
        {
            this.Logger.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");
        }
    }
}

这是local.settings.json

{
    "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "AzureWebJobsDashboard": "",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "StorageConnectionString": "UseDevelopmentStorage=true"
  }
}   

错误信息只是

[] Host lock lease acquired by instance ID '00000000000000000000000049821116'.
[] An unhandled exception has occurred. Host is shutting down.
[] Microsoft.WindowsAzure.Storage: Server encountered an internal error. Please try again after some time.
[] Stopping host...
[] Stopping JobHost
[] Job host stopped
[] Host shutdown completed.

我是新手,想了解更详细的错误信息。那可能吗 ? 非常感谢任何进一步的提示!

是的,您可以在本地调试中看到详细的错误信息。我自己创建了一个 Azure Blob 触发器,并将向您展示如何查看详细错误。请检查以下内容:

  1. 在代码中提到的容器中上传一个 blob(对我来说是 samples-workitems):

  1. 添加 try-catch 和如下日志语句:

  1. 现在,您将能够在 VS 控制台中看到日志错误:

  1. 对于托管函数应用程序中的错误消息,您将能够在 函数应用程序 > FUNCTION_APP_NAME > FUNCTION_NAME > 代码 + 测试 > 日志窗格中的门户上查看日志在底部。