.NET Server

ASP.NET Core WebDAV Server Sample with Azure Blob / Data Lake Storage Back-End

In this article

ASP.NET Core WebDAV Server Sample with Azure Blob / Data Lake Storage Back-End

This is a Class 2 WebDAV Server that keeps data in Azure Blob storage with Data Lake support. This sample publishes a hierarchical folder structure from Azure Data Lake and keeps locks, custom properties as well as file creation and modification dates in Azure Blob properties.

This sample is provided as part of the IT Hit WebDAV Server Engine v10.1 samples and later and is published to GitHub.

  • .NET Core 3.1 or later version on Windows, OS X, or Linux.
  • Microsoft Azure account.

Setting the License

To run the example, you will need a valid IT Hit WebDAV Server Engine License. You can download the license in the product download area. Note that the Engine is fully functional with a trial license and does not have any limitations. The trial license is valid for one month and the engine will stop working after this. You can check the expiration date inside the license file. Download the license file and specify it's content in License field under DavEngine in appsettings.webdav.json file.

You can also run the sample without explicitly specifying a license for 5 days. In this case, the Engine will automatically request the trial license from IT Hit website https://www.webdavsystem.com. Make sure it is accessible via firewalls if any. After 5 days the Engine will stop working. To extend the trial period you will need to download a license in a product download area and specify it in appsettings.webdav.json

Creating an Azure Blob Storage with Data Lake Support

  1. In your Microsoft Azure account go to Storage Accounts. Select Add:

    In Microsoft Azure account go to Storage Accounts. Select Add. 

    Fill the Storage account name field, you will specify it in the config file:Fill your Blob Storage account name field.

    Go to the Advanced tab and enable the Hierarchical namespace under the Data Lake Storage Gen2:

    Enable the Hierarchical namespace under the Data Lake Storage Gen2 on the Advanced tab.

     Select Review+Create. Confirm the storage account creation. 

    Specify the storage account name in appsettings.webdav.json as AzureStorageAccountName setting value.

  2. Go to Storage Accounts and find your newly created Azure Data Lake account. Select Access Keys under Settings:

    Find your newly created Data Lake account. Select Access Keys. Copy the access key. 

    Copy the Key and specify it in appsettings.webdav.json as AzureStorageAccessKey setting value.

  3. Go to Containers under the Data Lake Storage. Select +Container to create a new container. Fill the container name, you will specify it in the config file:

    Create a new Data Lake Storage container

    Confirm the new container creation.

    Specify the container name in appsettings.webdav.json as DataLakeContainerName setting value.

Publishing the Project to Azure

Note that the sample does not currently provide any authentication mechanism and allows full control anonymous access to the documents storage.

Note that this sample provides optimal performance when deployed directly to Microsoft Azure.

If you are using Visual Studio you can publish the project to Azure from Visual Studio project context menu:

In Visual Studio you can publish the project to Azure from Visual Studio project context menu.

To publish as an Azure App Service select the App Service option:

Creating Azure App Service

Note that you do NOT need to create a storage account in this wizard as you have created and configured it on previous steps.

Enabling Web Sockets

This project is using web sockets to update the user interface when any data is modified on the server-side. If you deploy your project as an App Service, by default web sockets will be disabled on the newly created app. To enable web sockets go to App Service Configuration and enable them on the General Settings tab:

Enable web sockets in the Azure App Service Configuration on the General Settings tab

Now you are ready to run the application. Open a web browser and navigate to https://<yourservicename>.azurewebsites.net:

WebDAV Server running on Azure as App Service

Next Article:

ASP.NET CalDAV Server Example with Microsoft SQL Back-end, C#