skip to Main Content

An error occurred while creating the IIS virtual directory

We are unable to recreate Exchange virtual directory in Exchange Management Shell, and a couple of errors are showing. An error occurred while creating the IIS virtual directory. The AD configuration for virtual directory already exists. This article will show why it’s happening and the solution to recreate Exchange IIS virtual directory.

Recreate owa virtual directory in Exchange Server

In the previous post, we already discussed how to recreate Exchange virtual directories. If you do it step by step, that works wonders. If you don’t follow the steps or impossible to follow, you can get errors when recreating the virtual directories.

In this example, the owa virtual directory is removed in Exchange Server. We like to recreate the owa virtual directory in IIS. If you have another virtual directory that you want to recreate, for example, the ecp virtual directory, you can follow the same steps. It applies to all Exchange virtual directories.

The AD configuration for virtual directory ‘owa’ already exists

Run Exchange Management Shell as administrator. Run the cmdlet and add the server name and the domain to both of the URLs. In our example, the Exchange Server and internal DNS are https://mail.exoip.com/owa.

Read more: Exchange 2016 namespace design and planning »

The following error shows up: The AD configuration for virtual directory ‘owa’ already exists.

Why do we get the error that the AD configuration for virtual directory ‘owa’ already exists and we have to remove this AD configuration manually?

Solution for the AD configuration for virtual directory ‘owa’ already exists

That’s because it’s not removed the right way trough Exchange Management Shell (EMS) with the RemoveOwaVirtualDirectory cmdlet. For example, it’s removed from IIS with a right-click on the virtual directory and remove.

Don’t remove the Exchange virtual directory from IIS Manager. Use the Exchange Management Shell instead.

An error occurred while creating the IIS virtual directory don't remove in IIS

There are two options. One of them is to remove it with EMS. The other one is with ADSI Edit.

Option 1: Remove owa virtual directory with EMS

Run Exchange Management Shell as administrator. Run the cmdlet to remove the owa virtual directory.

Option 2: Remove owa virtual directory with ADSI Edit

Start ADSI Edit. Right-click ADSI Edit in the left pane and select Connect to. Select Configuration in the well known naming Context. Click OK.

An error occurred while creating the IIS virtual directory ADSI Edit

Navigate in ADSI Edit:

Configuration > CN=Configuration,DC=exoip,DC=local > CN=Services > CN=Microsoft Exchange > CN=EXOIP > CN=Administrative Groups > CN=Exchange Administrative Group (FYDIBOHF23SPDLT) > CN=Servers > CN=EX01-2016 > CN=Protocols > CN=HTTP.

Delete CN=owa (Default Web Site).

An error occurred while creating the IIS virtual directory ADSI Edit delete virtual directory

In the next step, we will recreate the Exchange virtual directory.

An error occurred while creating the IIS virtual directory

In the previous step, we removed the virtual directory in EMS or with ADSI Edit. Let’s create the owa virtual directory in EMS.

This time another error shows up: An error occurred while creating the IIS virtual directory.

Why do we get an error occurred while creating the IIS virtual directory?

Solution for an error occurred while creating the IIS virtual directory

That’s because we did fix the issue in the last part, but there are leftovers in the IIS internal database called MetaBase. If we removed the virtual directory immediately with EMS, this error would not show up.

Install Microsoft Metabase Explorer 1.6

To look into the IIS database, we are going to use Microsoft Metabase Explorer 1.6. It’s part of the IIS 6.0 Resource Kit, which provides a graphical user interface (GUI) to view and edit local and remote IIS Metabase stores.

Download the IIS 6 Resource Kit (Microsoft) or here (direct link). Install Microsoft Metabase Explorer 1.6 on the Exchange Server.

Right-click on iis60rkt.exe, go to Properties, and check the checkbox Unblock (if available). Click OK.

Unable to recreate exchange virtual directory unblock setup

Right-click the setup and click Run as administrator. Click Next. Agree to the EULA and select Next. Fill out User Name and Company Name and click Next. Select Custom setup type and click Next.

Unable to recreate exchange virtual directory custom setup

Deselect all options except Metabase Explorer 1.6 and click Next.

An error occurred while creating the IIS virtual directory Metabase Explorer

Click Next, and when it’s done installing, click Finish.

Run Microsoft Metabase Explorer

Start Microsoft Metabase Explorer 1.6. Do you get the window that the feature .NET Framework 3.5 couldn’t be installed? Read the article Install .NET Framework 3.5 on Windows Server.

An error occurred while creating the IIS virtual directory .NET Framework

After starting the program, you can see that you are looking at the same structure as the Internet Information Services (IIS) Manager that you are familiar with.

IIS Metabase Explorer

An error occurred while creating the IIS virtual directory IIS Metabase Explorer

Internet Information Services (IIS) Manager

An error occurred while creating the IIS virtual directory IIS Manager

Remove owa from IIS Metabase Explorer

Go to the path: /LM/W3SVC/1/ROOT/owa/. Right-click on owa and click Delete.

An error occurred while creating the IIS virtual directory Metabase Explorer delete virtual directory

Run the cmdlet to recreate the OWA virtual directory and restart IIS. This time you will not get An error occurred while creating the IIS virtual directory.

Check if OWA is working

We can always verify in IIS Metabase Explorer that the data is recreated.

An error occurred while creating the IIS virtual directory Metabase Explorer check virtual directory

On the Exchange Server, browse to the OWA page URL https://FQDN/owa. In our example https://ex01-2016.exoip.local/owa. Or you can log in with the URL that you filled in the cmdlet to create the owa virtual directory. Both will work.

Unable to recreate exchange virtual directory login OWA

The Exchange Outlook Web Access (OWA) page did show up successfully. Did it work for you?

Keep reading: Exchange 2016 OWA your connection is not secure »

Conclusion

In this article, you learned why you are unable to recreate Exchange virtual directory. Don’t remove the virtual directory in IIS Manager as this will give you errors when recreating the virtual directory. Remove it with Exchange Management Shell with the correct cmdlet. If you do get an error, follow the steps to remove the virtual directory with MetaBase Explorer. Recreate the virtual directory in EMS to bring the virtual directory back to life.

Did you enjoy this article? You may also like Server Error in ‘/owa’ Application Exchange 2016. Don’t forget to follow us and share this article.

ALI TAJRAN

ALI TAJRAN

ALI TAJRAN is a passionate IT Architect, IT Consultant, and Microsoft Certified Trainer. He started Information Technology at a very young age, and his goal is to teach and inspire others. Connect with ALI TAJRAN on social media. Read more »

This Post Has 0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top