This guide explains how to deploy the MongoDB Migration Web-Based Utility to an on-premises Windows Server. This deployment option is ideal for migrating data from an on-premises MongoDB VM directly to Azure DocumentDB without needing to set up an Azure VPN.
Best for:
- ✅ Migrating from on-premises MongoDB VMs
- ✅ Eliminating need for Azure VPN setup
- ✅ Direct local access to source MongoDB
- ✅ Organizations with existing Windows Server infrastructure
- ✅ Data locality requirements during migration
- Windows Server with Remote Desktop access
- Internet access to download required components
- Administrative privileges on the server
- Existing MongoDB instance (source)
- Azure Cosmos DB account (target)
You can deploy the utility either by compiling the source files or using precompiled binaries.
- Log in to the Windows Server using Remote Desktop or a similar method
- Ensure the server has internet access to download required components
Download the .NET 9 Hosting Bundle:
- Visit the .NET Download Page
- Download the Hosting Bundle under the Runtime section
- Install the Hosting Bundle:
- Run the installer and follow the instructions
- This will install the ASP.NET Core Runtime and configure IIS to work with .NET applications
- Open Server Manager
- Click Add Roles and Features and follow these steps:
- Select Role-based or feature-based installation
- Choose the current server
- Under Server Roles, select Web Server (IIS)
- In the Role Services section, ensure the following are selected:
- Web Server > Common HTTP Features > Static Content, Default Document
- Web Server > Application Development > .NET Extensibility 4.8, ASP.NET 4.8
- Management Tools > IIS Management Console
- Click Install to complete the setup
Run the following PowerShell command:
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ASPNET45, IIS-NetFxExtensibility45- On the server, create an empty folder to store the MongoMigrationWebApp files. This folder will be referred to as the app directory
- Recommended path:
C:\inetpub\wwwroot\MongoMigrationWeb - Configure File Permissions:
- Right-click the app directory, select Properties > Security
- Ensure that the IIS_IUSRS group has Read & Execute permissions
- Open IIS Manager (search IIS in the Start menu)
- Right-click Sites in the left-hand pane and select Add Website
- Site Name: Enter a name for your site (e.g.,
MongoMigrationWeb) - Physical Path: Point to the app directory
- Binding: Configure the site to use the desired port (e.g., 8080 for HTTP)
- Site Name: Enter a name for your site (e.g.,
- In IIS Manager, select Application Pools
- Create a new Application Pool:
- Right-click and select Add Application Pool
- Name it (e.g.,
MongoMigrationWebPool) - Set the .NET CLR version to No Managed Code
- Select the site, click Basic Settings, and set the application pool to the one created
Choose one of the following options:
- Download the
.zipfile (excluding source code.zip and source code.tar.gz) from the latest release - Unzip the files to the app directory
- Ensure the
web.configfile is present in the root of your app directory. This file is critical for configuring the IIS hosting
-
Install .NET SDK
-
Clone/Download the repository:
https://github.com/AzureCosmosDB/MongoMigrationWebBasedUtility -
Open PowerShell
-
Navigate to the cloned project folder
-
Run the following commands in PowerShell:
# Variables to be updated $webAppName = <Replace with Web App Name> $projectFolderPath = <Replace with path to cloned repo on local> # Paths - No changes required $projectFilePath = "$projectFolderPath\MongoMigrationWebApp\MongoMigrationWebApp.csproj" $publishFolder = "$projectFolderPath\publish" $zipPath = "$publishFolder\app.zip" # Configure NuGet Path. Execute only once on a machine dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org # Build the Blazor app Write-Host "Building Blazor app..." dotnet publish $projectFilePath -c Release -o $publishFolder -warnaserror:none --nologo Write-Host "Published to $publishFolder"
-
Copy the contents of the published folder to the app directory
Restart IIS from the right-hand pane in IIS Manager.
Open your browser and navigate to:
http://localhost:8080(or the port you configured)- Or from another machine:
http://<ServerIP>:8080
If accessing the application from other machines:
- Open Windows Firewall with Advanced Security
- Create an inbound rule for the port (e.g., 8080)
- Allow TCP connections on that port
- Enable HTTPS: Configure SSL certificate in IIS for production use
- Authentication: Consider enabling Windows Authentication or other authentication methods in IIS
- Network Security: Restrict access to the application using firewall rules or network segmentation
- Check IIS logs:
C:\inetpub\logs\LogFiles - Check Application Event Viewer for .NET runtime errors
- Verify .NET 9 Hosting Bundle is installed correctly
- Ensure the Application Pool is running
- Verify IIS_IUSRS has Read & Execute permissions on the app directory
- Check that the Application Pool identity has necessary permissions
- Change the binding port in IIS to an available port
- Update firewall rules accordingly
If you need to scale up or move to Azure later:
- Deploy to Azure Web App - For small to medium workloads
- Deploy to Azure Container Apps - For large, long-running migrations