简体   繁体   English

账户存储文件azure,报错connection-azure.core.exceptions.ServiceRequestError

[英]Account storage files azure, error connection-azure.core.exceptions.ServiceRequestError

I have an app that connects to account storage files in azure. I am using Python to connect account storage resource.我有一个应用程序连接到 azure 中的帐户存储文件。我正在使用 Python 连接帐户存储资源。 One of the functions I use is 'create_directory()' from class 'from azure.storage.fileshare import (ShareDirectoryClient)'.我使用的功能之一是来自 class 的“create_directory()”“来自 azure.storage.fileshare import (ShareDirectoryClient)”。 Occasionally, Appears log:偶尔,出现日志:

Azure.core.exceptions.ServiceRequestError: (<urllib3.connection.HTTPSConnection object at 'object_resurce', 'Connection to 'name_of_the_account_storage_resurce'.file.core.windows.net timed out. (connect timeout=20)')

the func:功能:

def create_dir(self,dir_name:str):
        """ 
        This function will create a new directory in the storage account
        Args:
        -----
            share_name (str): The share client name of storage account.
            dir_name (str): The name of the created directory .
        """
        
      
            #check if the directory is exists in account storage
            if(self.dir_exists(dir_name)==False):
                # Create a DirectoryClient from a connection string
                self.dir_client = 
            ShareDirectoryClient.from_connection_string(                         
            conn_str=self.connection_string,
                                        share_name=self.share, 
                                        directory_path=dir_name)
            
                self.dir_client.create_directory(timeout=60)

How can I fix it?我该如何解决?

Tried to add timeout between connection tries, but didn't fix it试图在连接尝试之间添加超时,但没有修复

I tried in my environment and successfully created directory in the azure file share.我在我的环境中尝试并成功地在 azure 文件共享中创建了目录。

Code:代码:

from  azure.storage.fileshare  import  ShareDirectoryClient
connection_string="< Connection string >"
share_name="fileshare1"
dir_name="directory1"
dir_client = ShareDirectoryClient.from_connection_string(connection_string, share_name, dir_name)
print("Creating directory:", share_name + "/" + dir_name)
dir_client.create_directory()
print("Directory created!!!")

Console:安慰:

在此处输入图像描述

Portal:门户网站:

在此处输入图像描述

Reference: Develop for Azure Files with Python |参考: Develop for Azure Files with Python | Microsoft Learn 微软学习

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法将较大的 blob 上传到 Azure:azure.core.exceptions.ServiceRequestError:操作未完成(写入)(_ssl.Z4A8A08F09D37B73795649238408)BZF338 - Failing to upload larger blobs to Azure: azure.core.exceptions.ServiceRequestError: The operation did not complete (write) (_ssl.c:2317) Azure Blob 触发 function 存储帐户连接 - Azure Blob triggered function storage account connection Azure 分析服务与存储帐户的连接不起作用 - Azure Analysis services connection to storage account not working 到 Azure 云存储帐户的连接字符串 - Connection String to an Azure Cloud Storage Account 将平面文件上传到 Azure 存储帐户 - Uploading flat files to Azure Storage Account 从 Azure 存储帐户下载所有文件 - Download all files from Azure storage account Azure - 将文件从 VM 复制到存储帐户 - Azure - copy files from VM to a storage account Azure 门户中的 Azure 存储帐户连接字符串在哪里? - Where is Azure storage account connection string in Azure portal? 应用无法访问Azure存储帐户文件 - Azure Storage Account files not accessible by app 如何使用 .net 核心从不同存储帐户的 Azure 文件共享(不是 blob)复制文件 - How to copy files from Azure File-Share (not blob) of different storage account using .net core
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM