【发布时间】:2017-08-18 08:12:49
【问题描述】:
我们到处都可以找到如何将 azure 文件共享与其他 api 一起使用,但我有一个使用 System.File.IO 访问文件共享的旧版 .net 应用程序。如何使用 System.File.IO 访问文件共享?这些 azure 文件共享是为支持旧版应用程序而创建的,但如果我必须重写所有文件访问代码,我看不到这一点。
【问题讨论】:
标签: azure azure-storage file-sharing
我们到处都可以找到如何将 azure 文件共享与其他 api 一起使用,但我有一个使用 System.File.IO 访问文件共享的旧版 .net 应用程序。如何使用 System.File.IO 访问文件共享?这些 azure 文件共享是为支持旧版应用程序而创建的,但如果我必须重写所有文件访问代码,我看不到这一点。
【问题讨论】:
标签: azure azure-storage file-sharing
我得到了以下解决方案,我在应用启动时运行它:
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new
System.Diagnostics.ProcessStartInfo
{
FileName = "cmd.exe",
Arguments =
string.Format("net use * {0} /u:{1}", ConfigurationManager.ApplicationSettings("StaticServerRoot"), ConfigurationManager.ApplicationSettings("StaticServerRootCredentials"))
};
process.StartInfo = startInfo;
process.Start();
process.Kill();
StaticServerRootCredentials 看起来像这样“AZURE\{account} {key}”
我可以使用 cmdkey
【讨论】:
如何使用 System.File.IO 访问文件共享?
您可以使用 Azure 文件共享。完成 Azure 文件共享后,您可以使用 System.File.IO 通过同一 Windows 中的映射驱动器访问共享。
Mount an Azure File share and access the share in Windows
否则,您只能使用 REST API 或任何客户端 SDK 访问文件共享。如果您使用 .NET Framework,则可以下载并使用 Azure Storage .NET SDK。
【讨论】: