我按照Microsoft文档部署了一个存储帐户边缘模块,我的模块目前正在我的虚拟机中运行。但是,我无法将Python SDK或存储资源管理器连接到它。
我的容器创建选项是:
{
"Env": [
"localstorage",
"92RhvUXR59Aa8h90LSHC7w=="
],
"HostConfig": {
"Binds": [
"blobvolume:/blobroot"
],
"PortBindings": {
"11002/tcp": [
{
"HostPort": "11002"
}
]
}
}
}我的模块双胞胎设置是
{
"deviceAutoDeleteProperties": {
"deleteOn": false,
"deleteAfterMinutes": 0,
"retainWhileUploading": true
},
"deviceToCloudUploadProperties": {
"uploadOn": true,
"uploadOrder": "OldestFirst",
"cloudStorageConnectionString": "<<my connection string was here :) >>",
"storageContainersForUpload": {
"eds-container-pcu": {
"target": "eds-container-pcu"
}
},
"deleteAfterUpload": true
}
}iotedge列表上写着
blobstorage running Up 5 hours mcr.microsoft.com/azure-blob-storage:latest我还检查了音量。我把一个文件放到我的卷中的"BlockBlob“文件夹中,然后我进入容器的外壳,在/blobroot下我可以找到这个文件。
我还复制了云存储连接字符串,并将其用于文件上传,这也是有效的。我可以成功地将文本文件上传到我的云存储帐户中。
我的本地存储帐户的连接字符串应该是这样的,不是吗?我自己创建的,就像医生说的那样:
DefaultEndpointsProtocol=http;BlobEndpoint=http://localhost:11002/localstorage;AccountName=localstorage;AccountKey=92RhvUXR59Aa8h90LSHC7w==;使用该连接字符串,我无法连接任何内容。不是SDK,也不是Storage Explorer。
Python代码将是:
CONNECTION_STRING = "DefaultEndpointsProtocol=http;BlobEndpoint=http://localhost:11002/localstorage;AccountName=localstorage;AccountKey=92RhvUXR59Aa8h90LSHC7w==;"
blobClient = BlobClient.from_connection_string(CONNECTION_STRING, "eds-container-pcu", "test123.txt")
# Doesn't work with or without this line
blobClient._X_MS_VERSION = '2017-04-17'
blobClient.upload_blob(data="Hello World", blob_type="BlockBlob")我得到了:
HttpResponseError: Server encountered an internal error. Please try again after some time.
RequestId:fef9066d-323c-47e3-8e6f-ba006557ee65
Time:2021-04-08T14:33:23.7892893Z
ErrorCode:InternalError
Error:None
ExceptionDetails:None
ExceptionMessage:'s' cannot be null
StackTrace:AsyncHelper.ArgumentNullRethrowableException: 's' cannot be null
---> System.ArgumentNullException: Value cannot be null. (Parameter 's')
at System.Convert.FromBase64String(String s)
at Microsoft.AzureStack.Services.Storage.FrontEnd.WossProvider.WStorageAccount..ctor(WStorageStamp stamp, String accountName)
at Microsoft.AzureStack.Services.Storage.FrontEnd.WossProvider.WStorageStamp.Microsoft.Cis.Services.Nephos.Common.Storage.IStorageStamp.CreateAccountInstance(String accountName, ITableServerCommandFactory tableServerCommandFactory)
at Microsoft.Cis.Services.Nephos.Common.Storage.PerRequestStorageManager.CreateAccountInstance(String accountName)
at Microsoft.Cis.Services.Nephos.Common.Protocols.Rest.BasicHttpProcessorWithAuthAndAccountContainer`1.GetResourceAccountPropertiesImpl(String accountName, Boolean isAdminAccess, TimeSpan timeout, AsyncIteratorContext`1 context)+MoveNext()
at AsyncHelper.AsyncIteratorContextBase.ExecuteIterator(Boolean inBegin)
--- End of inner exception stack trace ---
at Microsoft.Cis.Services.Nephos.Common.Protocols.Rest.BasicHttpProcessorWithAuthAndAccountContainer`1.EndGetResourceAccountProperties(IAsyncResult asyncResult)
at Microsoft.Cis.Services.Nephos.Common.Protocols.Rest.BasicHttpProcessorWithAuthAndAccountContainer`1.ProcessImpl(AsyncIteratorContext`1 async)+MoveNext()为什么会这样呢?存储资源管理器也没有连接,上面的代码行与我的云存储连接字符串一起工作得很好。
发布于 2021-04-09 14:27:24
一位同事指出,我的本地账户密钥太短。正如文档中所写的,密钥的长度必须为64字节。那么与SDK或StorageExplorer的连接就可以了。我的代码也没有创建本地容器,但是错误消息会告诉你这一点。
发布于 2021-04-09 15:25:27
在容器创建选项的示例中,我缺少键(LOCAL_STORAGE_ACCOUNT_NAME和LOCAL_STORAGE_ACCOUNT_KEY)。您是否仅指定了值?
"Env": [
"LOCAL_STORAGE_ACCOUNT_NAME=localstorage",
"LOCAL_STORAGE_ACCOUNT_KEY=92RhvUXR59Aa8h90LSHC7w=="
],当我使用这些设置部署模块时,我可以通过Storage Explorer进行连接。
你看过blob存储模块的日志了吗?
https://stackoverflow.com/questions/67006294
复制相似问题