1. Knowledge Base
  2. MDaemon® Email Server

How to setup Webmail, ActiveSync, CalDav, CardDav, and AutoDiscover services in IIS

The following procedure details how to setup Webmail, ActiveSync, CalDAV, CardDAV, and AutoDiscover to run under IIS10 for Windows 2016 with the 64-bit version of MDaemon installed.

  1. Install the Web Server Role with ISAPI support (for exact steps please consult your Operating System documentation)
  2. Close Internet Information Services (IIS) Manager if it's open
  3. Install Microsoft's IIS URL Rewrite 2.0 (Required for ActiveSync and CalDAV/CardDAV protocols)
    1. Other languages are available here; https://www.iis.net/downloads/microsoft/url-rewrite#additionalDownloads
    2. Navigate to http://www.iis.net/download/URLRewrite in a web browser
    3. Run the installer to install the extension
  4. Open the IIS Manager 
    To do this:
    1. Click Start
    2. Click All Programs
    3. Click Administrative Tools
    4. Click Internet Information Services (IIS) Manager
  5. On the Connections pane, expand the [Machine_name] node
    1. Right click on Sites
    2. Click Add Web Site
      iis_add-website-01-07
    3. Enter a Site name (i.e. Webmail). This will also create an Application Pool by the same name as the web site (do not manually create an Application Pool).
    4. Click the browse button (the button with '...') by Physical path and browse to the 'MDaemon\WorldClient\HTML' directory
    5. Set up the bindings as desired in the Binding section
    6. Click OK
      iis_add-website-02-11
    7. Click on the Webmail site in the Connections pane. 
    8. Double click on Default Document 
      iis_default-document-03-13
    9. Verify the default document is worldclient.dll
    10. Remove any existing Default Documents other than worldclient.dll
    11. Click Add and enter 'worldclient.dll' if the entry does exist
      iis_worldclient-dll-04-16
    12. Click on the Webmail site in the Connections pane 
    13. Double click on Handler Mappings 
      iis_webmail-handler-mapping-05-18
    14. Click Edit Feature Permissions on the Actions pane. 
      iis_edit-feature-permissions-06-19
    15. Verify the boxes for Read and Script are selected (checked), and select (check) the box for Execute
    16. Click OK 
      iis_feature_permissions-07-21
    17. Double click ISAPI-dll under the Enabled column 
    18. Change the value for the Request Path field from '*.dll' to 'WorldClient.dll'
    19. Set Module as IsapiModule
    20. Under Executable, click the browse button (the button with '...')
    21. Browse to 'MDaemon\WorldClient\HTML\WorldClient.dll' (on the C:\ drive by default)
    22. Click OK 
      iis_edit-module-mapping-08-27
    23. Click Yes on the dialog that asks 'Do you want to allow this ISAPI extension...'
      iis_click-yes-09-28

MDaemon versions 22.0 and above will need to add another MIME type to the list.

  1. Select the Webmail site folder.
  2. Double click MIME Types
  3. Click Add...
  4. Enter .cjs in the File name extension textbox.
  5. Enter text/javascript in the MIME type textbox.
    mdaemon_mime_types_add_window
  6. Click Ok

MDaemon versions 19.5 and above will need to perform additional steps to utilize the Pro theme.

  1. Edit the Default Document of the Webmail folder
    1. Select the Webmail folder (not to be confused with the Webmail site name in this example) 
    2. Double click Default Document
    3. Select the WorldClient.dll default document
    4. Click Remove
      iis_default-document-pro-10-29-4-2
    5. Click Add
    6. Enter index.html
    7. Click OK
      iis_index-html-11-29-7-2
  2. Redirect WorldClientAPI requests to the worldclient.dll
    1. Select the Webmail website
    2. Double click on Handler Mappings
    3. Select Add Script Map...
      iis_add-script-map-12-29-3
    4. Enter WorldClientAPI in the Request Path
    5. The Executable Path is the worldclient.dll in the \MDaemon\WorldClient\HTML directory
    6. Enter WorldClientAPI for the name
    7. Click Request Restrictions
      iis_add-script-map-13-29-2-7
    8. Remove the check mark in the Invoke handler only if request is mapped to:
      iis_request-restrictions-14-29-1-8
    9. Select the Verbs tab and verify All verbs is selected
      iis_request-restrictions-verbs-14-29-2-8
    10. Select the Access tab and select Execute
      iis_request-restrictions-access-15-29-2-9
    11. Click OK
    12. Click Yes
      iis_script-map-yes-16-29-2-10

  3. Create URL Rewite
    1. Select the Webmail folder (not to be confused with the Webmail site name in this example)
    2. Double Click URL Rewrite
    3. Select Add Rules from the Actions menu
    4. Select Blank rule
      iis_url-rewrite-add-rule-03-04a
    5. Click OK
    6. Enter a name for the Inbound Rule
    7. Select Matches the Pattern in the Requested URL
    8. Select Regular Expressions in the Using drop down
    9. Enter .* in the Pattern text box
      iis_edit-inbound-rule-03-08a-b
    10. Expand the Conditions section
    11. Click Add in the Condition section
    12. Select Is Not a Directory in the Check if input string section
      This changes the Condition to {REQUEST_FILENAME}
    13. Click OK
    14. Click Add in the Condition section
    15. Select Is Not a File in the Check if input string section
      This changes the Condition to {REQUEST_FILENAME}
    16. Click OK
    17. Select Rewrite for the Action Type
    18. Enter index.html in the Action Properties
    19. Check Append query string
    20. Check Log rewritten URL
      iis_log-rewritten-url-03-08a-d
    21. Click Apply to apply the Inbound rule

Add the MDAirSync.dll mapping is IIS
  1. On the Handler Mappings Actions menu on the right, click on 'Add Script Map...' 
    iis_mdairsync-handler-mapping-17-30-1
  2. In the Request Path field, enter 'MDAirSync.dll'
  3. Under Executable, click the browse button (the button with '...')
  4. Browse to 'MDaemon\WorldClient\HTML\MDAirSync.dll' (on the C:\ drive by default)
  5. In the Name field, enter 'MDAirSync.dll'
  6. Click the Request Restrictions button 
    iis_mdairsync-add-script-map-18-30-6
  7. Under the Access tab, select Execute
    iis_mdairsync-request-restrictions-19-30-7
  8. Click OK
  9. Click OK 
  10. Click Yes on the dialog that asks 'Do you want to allow this ISAPI extension...'

Add the AutoDiscover service to IIS
  1. On the Handler Mappings Actions menu on the right, click on 'Add Script Map...' 
  2. In the Request Path field, enter 'MDAutoDiscover.dll'
  3. Under Executable, click the browse button (the button with '...')
  4. Browse to 'MDaemon\WorldClient\HTML\MDAutoDiscover.dll' (on the C:\ drive by default)
  5. In the Name field, enter 'MDAutoDiscover.dll'
  6. Click the Request Restrictions button
    iis_autodiscover-add-script-map-20-31-6 
  7. Under the Access tab, select Execute
    iis_autodiscover-request-restrictions-21-31-7
  8. Click OK
  9. Click OK 
  10. Click Yes on the dialog that asks 'Do you want to allow this ISAPI extension...'

Add the CalDAV service to IIS

NOTE: If IIS had been configured prior to MDaemon 22, please remove the URL Rewrite rule for CalDav and run through the steps below.

  1. Select the Webmail site from the Connections panel.
  2. Double click Handler Mappings
  3. Click Add Script Map...
  4. Enter /.well-known/caldav in the Request Path textbox.
  5. Enter C:\MDaemon\WebDAV\MDWebDAV.dll in the Executable textbox.
    (Modify the directory path if MDaemon was not installed on the C:\ directory)
  6. Enter a name in the Name field; i.e MDCalDav.
    mdaemon_caldav_script_map
  7. Click Request Restrictions
  8. Select the Verbs Tab and verify All Verbs is selected.
  9. Select the Access Tab and choose Execute
    mdaemon_caldav_script_map_execute
  10. Click OK
  11. Click OK
  12. Click Yes to allow the ISAPI extension.

Add the CardDav service to IIS

NOTE: If IIS had been configured prior to MDaemon 22, please remove the URL Rewrite rule for CardDav and run through the steps below.

  1. Select the Webmail site from the Connections panel.
  2. Double click Handler Mappings
  3. Click Add Script Map...
  4. Enter /.well-known/carddav in the Request Path textbox.
  5. Enter C:\MDaemon\WebDAV\MDWebDAV.dll in the Executable textbox.
    (Modify the directory path if MDaemon was not installed on the C:\ directory)
  6. Enter a name in the Name field; i.e MDCardDav.
    mdaemon_carddav_script_map
  7. Click Request Restrictions
  8. Select the Verbs Tab and verify All Verbs is selected.
  9. Select the Access Tab and choose Execute
    mdaemon_caldav_script_map_execute
  10. Click OK
  11. Click OK
  12. Click Yes to allow the ISAPI extension.

To configure the Microsoft ActiveSync protocol in IIS, complete these steps:
  1. Press Start
  2. Select Administrative Tools
  3. Click Internet Information Services (IIS) Manager
  4. Under Inbound Rules, select Blank Rule and click OK 
  5. Name the rule: MDAirSync.dll
  6. Under Match URL set these settings:
    1. Requested URL: Matches the Pattern (default)
    2. Using: Regular Expressions (default)
    3. Pattern: ^Microsoft-Server-ActiveSync
    4. Ignore Case: Enabled (default) 
      iis_activesync_regex-28-34-6-3
  7. Under Action set these settings:
    1. Action type: Rewrite (default)
    2. Rewrite URL: mdairsync.dll
    3. Append query string: Enabled (default) 
      iis_activesync-url-rewrite-29-34-6-4
  8. In the Actions pane, click Apply 
  9. In the Actions pane, click Back to Rules
    iis_activesync-rules-30-34-6
If using Windows Server 2008 64-bit or Windows Server 2008 R2, configure the Webmail Application Pool:
  1. Double-click on Application Pools on the Connections pane
  2. Select the Webmail application pool 
  3. On the Actions pane, click Advanced Settings... 
    iis_64-bit-advanced -settings-31-35-3
  4. In the General section, locate 'Enable 32-bit Applications'
  5. Select the field and choose False 
  6. In the Process Model section, set Identity to Network Service
  7. Click OK

Update the NTFS permissions of the MDaemon directory:
  1. Open Windows Explorer
  2. Navigate to the MDaemon directory (by default, 'C:\MDaemon'
  3. Right click on the MDaemon directory
  4. Choose Properties 
    iis_nfts_properties-32-36-4
  5. Choose the Security tab
  6. Click Edit 
    iis_nfts_mdaemon-properties-33-36-6
  7. Click Add 
  8. Type 'IUSR'
  9. Click OK to close the Select Users or Groups dialog 
    iis_nfts-select-users-groups-34-36-9
  10. Enable Full control under Allow for IUSR 
    iis_nfts-mdaemon-permissions-35-36-10
  11. Click Add... 
  12. Type 'Network Service'
  13. Click OK to close the Select Users or Groups dialog 
    iis_nfts-mdaemon-permissions-iusr-35-36-10
  14. Enable Full Control under Allow for Network Service
  15. Click OK to close the Permissions for MDaemon dialog and wait for the changes to take effect 
    iis_nfts-mdaemon-permissions-network-37-36-15
  16. Click OK to close the MDaemon Properties dialog 

Switch over from MDaemon's built-in webserver to IIS

  1. Open the MDaemon console
  2. Click Start
  3. Click All Programs
  4. Click MDaemon
  5. Click Start MDaemon
  6. Open the Setup menu
  7. Click Web & IM Services... 
  8. Select WorldClient runs using external webserver (IIS, Apache, etc)
    iis_mdaemon-webserver-38-7
  9. Click OK