public void Mount(string driveLetter, string uncPath, string userName, string accessKey, ILog logger) { if (IsShareConnected(uncPath, logger)) { return; } lock (LockObject) { if (IsShareConnected(uncPath, logger)) { return; } FilesMappedDrive.Mount(driveLetter, uncPath, userName, accessKey); } }
public override bool OnStart() { if (!RoleEnvironment.IsEmulated) { try { CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("DataConnectionString")); var key = storageAccount.Credentials.ExportBase64EncodedKey(); var storageAccountName = storageAccount.Credentials.AccountName; // Mount a drive. FilesMappedDrive.Mount("Y:", @"\\" + storageAccountName + @".file.core.windows.net\solutions", storageAccountName, key); } catch (Exception exc) { while (exc is AggregateException) { exc = exc.InnerException; } Trace.TraceError("Error trying to mount Azure File {0}", exc.ToString()); WriteToTempFile(exc.ToString()); } } // Set the maximum number of concurrent connections //ServicePointManager.DefaultConnectionLimit = 12; // For information on handling configuration changes // see the MSDN topic at https://go.microsoft.com/fwlink/?LinkId=166357. RoleEnvironment.Changing += RoleEnvironmentOnChanging; bool result = base.OnStart(); Trace.TraceInformation("OrleansWorkerRole has been started"); return(result); }
/// <summary> /// Use FileMappedDrive (from the RedDog.Storage project) to mount a drive. /// </summary> /// <param name="context"></param> public void Init(HttpApplication context) { FilesMappedDrive.Mount("Z:", @"\\azurefileservicedemo.file.core.windows.net\pictures", "azurefileservicedemo", "7DR/wKFA80CiRbiO5EvDZgVkdf+cCRnJqSW8md/gDy2aZXm1JqwcLy76riMJHIprsPgOshj8f7KekSxWhXiItg=="); }