To deploy multiple Web APIs to the same IIS, you can consider two methods:
-
Method 1: creating multiple websites and then deploying Web APIs separately to each website;
-
Method 2: deploying multiple Web APIs to different sub-folders under the same website.
This section walks you through deploying Web APIs to the sub-folder of the website (Method 2).
Step 1: Right click the IIS website and then select Explore. In the opened folder, create a sub-folder (suppose the sub-folder name is "api1").
Step 2: Copy the published files of the Web APIs to this sub-folder.
Step 3: Right click the sub-folder under the IIS website and then select Convert to Application.
If the sub-folder is not listed under the website, you can refresh the website first.
Make sure the application will use a unique application pool (it cannot share the application pool with the other Web APIs). You can click Select to select a unique application pool. (Or you can modify later by right-clicking the sub-application and then selecting Manage Application > Advanced Settings > Application Pool).
For more information, refer to IIS sub-application.
Step 4: Make sure to include the path of the sub-folder when you specify the Web API URL. For example, https://172.16.100.83:81/api1.
Note
Deploying multiple client apps to the sub-folder of the website is much simpler; you don't need to take step 3 (convert to application and assign unique application pool). You only need to deploy or copy the client app files to the sub-folder and then include the sub-folder in the URL when accessing the client app.