public IPlugin Install(Configuration.Config c) { if (vpp != null) { throw new InvalidOperationException("This plugin can only be installed once, and cannot be uninstalled and reinstalled."); } if (string.IsNullOrEmpty(blobStorageConnection)) { throw new InvalidOperationException("This plugin needs a connection string for the Azure blob storage."); } if (string.IsNullOrEmpty(blobStorageEndpoint)) { throw new InvalidOperationException("This plugin needs a blob end point; the default will be [http|https]://myaccount.blob.core.windows.net."); } if (!blobStorageEndpoint.EndsWith("/")) { blobStorageEndpoint += "/"; } if (string.IsNullOrEmpty(vPath)) { vPath = "~/azure/"; } vpp = new AzureVirtualPathProvider(blobStorageConnection); vpp.VirtualFilesystemPrefix = vPath; vpp.LazyExistenceCheck = lazyExistenceCheck; if (RegisterAsVirtualPathProvider) { try { HostingEnvironment.RegisterVirtualPathProvider(vpp); } catch (SecurityException) { this._failedToRegisterVpp = true; c.Plugins.VirtualProviderPlugins.Add(vpp); //Fall back to VIP instead. } } // Register rewrite c.Pipeline.PostRewrite += Pipeline_PostRewrite; c.Plugins.add_plugin(this); return(this); }
public IPlugin Install(Configuration.Config c) { if (vpp != null) throw new InvalidOperationException("This plugin can only be installed once, and cannot be uninstalled and reinstalled."); if (string.IsNullOrEmpty(blobStorageConnection)) throw new InvalidOperationException("This plugin needs a connection string for the Azure blob storage."); if (string.IsNullOrEmpty(blobStorageEndpoint)) throw new InvalidOperationException("This plugin needs a blob end point; the default will be [http|https]://myaccount.blob.core.windows.net."); if (!blobStorageEndpoint.EndsWith("/")) blobStorageEndpoint += "/"; if (string.IsNullOrEmpty(vPath)) vPath = "~/azure/"; vpp = new AzureVirtualPathProvider(blobStorageConnection); vpp.VirtualFilesystemPrefix = vPath; vpp.LazyExistenceCheck = lazyExistenceCheck; if (RegisterAsVirtualPathProvider) { try { HostingEnvironment.RegisterVirtualPathProvider(vpp); } catch (SecurityException) { this._failedToRegisterVpp = true; c.Plugins.VirtualProviderPlugins.Add(vpp); //Fall back to VIP instead. } } // Register rewrite c.Pipeline.PostRewrite += Pipeline_PostRewrite; c.Plugins.add_plugin(this); return this; }
public AzureFile(string blobName, AzureVirtualPathProvider parentProvider) : base(blobName) { parent = parentProvider; }