使用SignalR ServerlessHub运行Azure Function时遇AzureWebJobsStorage错误
问题与解决方法:基于ServerlessHub的Azure Function SignalR触发器错误
错误日志
Microsoft.Azure.WebJobs.Host: 索引方法'GetWnsetdsbyani'时出错。Microsoft.Azure.WebJobs.Extensions.SignalRService: 由于'AzureWebJobsStorage'连接字符串未设置或无效,SignalR触发器已禁用。Azure.RequestFailedException: 服务请求失败。 [2023-07-29T21:25:21.309Z] 状态: 500 (内部服务器错误) [2023-07-29T21:25:21.310Z] [2023-07-29T21:25:21.311Z] 请求头: [2023-07-29T21:25:21.311Z] Server: Azurite-Blob/3.14.1 [2023-07-29T21:25:21.312Z] Date: Sat, 29 Jul 2023 21:25:20 GMT [2023-07-29T21:25:21.313Z] Connection: keep-alive [2023-07-29T21:25:21.313Z] Keep-Alive: REDACTED [2023-07-29T21:25:21.314Z] Content-Length: 0 [2023-07-29T21:25:21.315Z] [2023-07-29T21:25:21.315Z] 在 Azure.Storage.Blobs.BlobRestClient.DownloadAsync(String snapshot, String versionId, Nullable`1 timeout, String range, String leaseId, Nullable`1 rangeGetContentMD5, Nullable`1 rangeGetContentCRC64, String encryptionKey, String encryptionKeySha256, Nullable`1 encryptionAlgorithm, Nullable`1 ifModifiedSince, Nullable`1 ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, CancellationToken cancellationToken) [2023-07-29T21:25:21.316Z] 在 Azure.Storage.Blobs.Specialized.BlobBaseClient.StartDownloadAsync(HttpRange range, BlobRequestConditions conditions, Boolean rangeGetContentHash, Int64 startOffset, Boolean async, CancellationToken cancellationToken) [2023-07-29T21:25:21.316Z] 在 Azure.Storage.Blobs.Specialized.BlobBaseClient.DownloadStreamingInternal(HttpRange range, BlobRequestConditions conditions, Boolean rangeGetContentHash, String operationName, Boolean async, CancellationToken cancellationToken) [2023-07-29T21:25:21.317Z] 在 Azure.Storage.Blobs.Specialized.BlobBaseClient.DownloadInternal(HttpRange range, BlobRequestConditions conditions, Boolean rangeGetContentHash, Boolean async, CancellationToken cancellationToken) [2023-07-29T21:25:21.318Z] 在 Azure.Storage.Blobs.Specialized.BlobBaseClient.DownloadAsync(HttpRange range, BlobRequestConditions conditions, Boolean rangeGetContentHash, CancellationToken cancellationToken) [2023-07-29T21:25:21.318Z] 在 Azure.Storage.Blobs.Specialized.BlobBaseClient.DownloadAsync(CancellationToken cancellationToken)
解决步骤
确认
AzureWebJobsStorage连接字符串配置- 本地开发:打开
local.settings.json,确保Values节点下包含"AzureWebJobsStorage": "UseDevelopmentStorage=true"(使用Azurite模拟器),或者替换为Azure云存储账户的有效连接字符串。 - 生产环境:登录Azure门户,进入目标Function应用的「配置」-「应用程序设置」,添加或更新
AzureWebJobsStorage项,填入正确的存储账户连接字符串。
- 本地开发:打开
修复Azurite模拟器问题(本地开发场景)
- 重启Azurite服务,确保模拟器处于运行状态;
- 检查Azurite的存储目录是否有读写权限,必要时删除现有存储文件后重新初始化;
- 确认连接字符串中的端点与Azurite配置一致,默认Blob端点为
http://127.0.0.1:10000,若修改过端口需同步调整连接字符串。
验证SignalR服务连接配置
- 确保
AzureSignalRConnectionString也已正确配置(本地在local.settings.json,生产在门户应用设置),该连接字符串需从Azure SignalR服务实例的「密钥」页面获取。
- 确保
内容的提问来源于stack exchange,提问作者Muzaffar Mahmood
相关产品推荐
相关产品推荐

