Namespace: Gosso.EPiServerAddOn.DownloadIfMissingFileBlob version 2.1.1 (2018-10-22)
Applicable to CMS >9.0 (MVC or Webforms) - tested with CMS9.6.1 and CMS 10.0.1.0, compiled with CMS 9, use version 1.6
NOT TESTED with AZURE File Storage
Work side by side with Imagevault but is not copying vault images
Compatible with ImageResizer.Plugins.EPiServerBlobReader
Ever restored the Production database to your developer environment and got a website without images? This lightweight AddOn keeps your local environment blob directory up to date.
This AddOn provider copies (when page loads) the file blobs from production to your local environment, or to your staging/test environment.
This AddOn is heaven for developers, get rid of copying the production blobs to your local installations.
When the EPiServer CMS page is binding the model to the page, the Provider GetBlob(URI id) is called for every Blob used on the loaded page. The Download If Missing File Blob Provider check if file exists on the local blob directory, if not it requests the Gosso.EpiserverAddOn.DownloadIfMissingFileBlob.UrlResolver.ashx* on the Production server and downloads the file with the friendly URL.
*this ashx webhandler is automaticly added on init
*The DownloadIfMissingFileBlobProvider is using a web request to the ashx on the production server since the local database is locked (because of possible risk of eternal loop) during request and we don’t have the possibility to find out the friendly URL to the file.
Yes, initially on application load, it will take some time to download the loaded files.
Activated is needed to get it working. Set to true on DEV, och false in PROD.
ProdUrl is pointing to the production server and appends the friendly relative url when downloading the files. For example ProdUrl + “globalassets/images/folder/name.png”
UrlResolverUrl is NOT mandatory, can be empty, it is used to get the friendly relative url of the blob.
RestrictedFileExt helps to restrict which files to not download
Path to the blob url (default "[appDataPath]\blobs")
Cookies adds cookies to the request made when getting the blobs in the format of: cookie1=cookieValue1;cookie2=cookieValue2
<episerver.framework>
<blob defaultProvider="MissingFileBlobProvider">
<providers>
<add name="MissingFileBlobProvider"
Activated="true"
ProdUrl="http://www.gosso.se/"
UrlResolverUrl="modules/Gosso.EPiServerAddOn.DownloadIfMissingFileBlob/urlresolver.ashx"
RestrictedFileExt=".docx.doc.pdf.exe.zip.mov.mp4"
Cookies="cookie1=cookieValue1;cookie2=cookieValue2"
type="Gosso.EPiServerAddOn.DownloadIfMissingFileBlob.Provider, Gosso.EPiServerAddOn.DownloadIfMissingFileBlob" />
</providers>
</blob>
</episerver.framework>
Under the release tab you may download the nuget package to your local feed for installation with package manager console in Visual Studio. It will install one file, the Gosso.EPiServerAddOn.MissingFileBlobProvider.dll into the bin folder. Also configure episerverframework.config/web.config with the MissingFileBlob.
In Package Manager Console i recommend 'install-package Gosso.EPiServerAddOn.DownloadIfMissingFileBlobProvider -IgnoreDependencies' if you have compatibility problems. It is dependent to EPiServer.
You can also download the source code project and add it to your solution, therefore you may easily debug it if needed.
If you want to change the default URLResolver path, you may use this web.config and change the UrlResolverUrl Also put the file urlresolver.ashx at that place
<location path="modules/Gosso.EPiServerAddOn.DownloadIfMissingFileBlob">
<system.webServer>
<handlers>
<add name="DownloadIfMissingFileBlob" path="/modules/Gosso.EPiServerAddOn.DownloadIfMissingFileBlob/UrlResolver.ashx" verb="GET" type="Gosso.EPiServerAddOn.DownloadIfMissingFileBlob.UrlResolverHelper, Gosso.EpiserverAddOn.DownloadIfMissingFileBlob" />
</handlers>
</system.webServer>
</location>
use log4net:
<logger name="Gosso" additivity="true">
<level value="Debug" />
</logger>
Starting from version 2.0.0, EPiServer.Logging.Log4Net uses a log4net version that is not compatible with previous version (Nuget version 2.0.3 or assembly version 1.2.13). Resolution change to publicKeyToken="669e0ddf0bb1aa2a"