All Products
Search
Document Center

:How do I resolve the issues that occur when I access IIS websites?

Last Updated:Apr 23, 2023

This topic describes the issues that occur when you access Internet Information Services (IIS) based websites on Elastic Compute Service (ECS) instances and how to resolve the issues.

This topic describes the following issues:

What do I do if the "500 Internal Server Error" error message appears when you access an IIS website that is deployed on a Windows instance?

Problem description

When you access an IIS website that is deployed on a Windows instance, the "500 Internal Server Error" error message appears.

Cause

The error message does not include error details. You must check the actual error information about the website to identify and resolve the issue. The following section describes how to check the actual error information about the website in this scenario.

Note

You can also perform the operations that are described in What do I do if I cannot access a website hosted on an instance? to troubleshoot the issue.

Solution

Note

In this example, an instance that runs Windows Server 2019 Datacenter 64-bit (English) is used. The operations that you must perform may vary based on the operating system of your instance.

Perform the following steps to check the actual error information about the website:

  1. Connect to the Windows instance.

    For more information, see Connection methods.

  2. In the lower-left corner of the desktop, choose Start icon > Server Manager.

    Start Server Manager
  3. In upper-right corner of the Server Manager window, choose Tools > Internet Information Services (IIS) Manager.

  4. In the left-side navigation pane of the Internet Information Services (IIS) Manager window, click the website. View the IIS website

  5. In the IIS section, double-click Error Pages.

  6. In the right-side pane of the Internet Information Services (IIS) Manager window, click Edit Feature Settings in the Actions section. Edit Feature Settings

  7. In the Edit Error Pages Settings dialog box, select Detailed errors and click OK. Detailed errors

  8. Use a browser to access the website and press Ctrl+F5 to forcefully refresh the browser.

    You can view the actual error information about the website.

  9. Resolve the issue based on the error information and then access the website again.

    If the issue is resolved, you can access the website.

How do I disable direct IP access to an IIS website on a Windows instance?

Problem description

An IIS website is deployed on a Windows instance. Direct IP access to the website is enabled and allows you to access the website by using the IP address of the Windows instance. If domain names can be resolved to the IP address of the Windows instance, including malicious domain names and domain names that do not have an Internet Content Provider (ICP) filing, the domain names can be used to access the website. In this case, security risks may occur.

Cause

The preceding issue occurs because a binding that includes an empty Host header is configured for the website in IIS.

Solution

Note

In this example, an instance that runs Windows Server 2019 Datacenter 64-bit (English) is used. The operations that you must perform may vary based on the operating system of your instance.

You can disable direct IP access to the IIS website by removing the binding that includes an empty Host header. To remove the binding, perform the following steps:

  1. Connect to the Windows instance.

    For more information, see Connection methods.

  2. Start IIS Manager.

    1. In the lower-left corner of the desktop, choose Start icon > Server Manager.

      Start Server Manager
    2. In upper-right corner of the Server Manager window, choose Tools > Internet Information Services (IIS) Manager.

  3. In the left-side navigation pane of the Internet Information Services (IIS) Manager window, click the website. Then, click Bindings in the Actions column in the right-side pane. In the Site Bindings dialog box, a binding that includes an empty Host header (Host Name parameter) is displayed. Add a binding to bind a domain name to the website.

    In this example, the domain name example.aliyundoc.com is bound, as shown in the following figure. Bind a domain name

  4. Use the public IP address of the instance and the domain name example.aliyundoc.com to access the website.

    • The website can be accessed by using the public IP address of the instance and the domain name, as shown in the following figures.

    • If a malicious domain name or a domain name such as demo.aliyundoc.com that does not have an ICP filing is resolved to the IP address of the instance, the domain name can be used to access the website even though the domain name is not bound as a host name in IIS, as shown in the following figure.

  5. Disable direct IP access to the website.

    1. In the left-side navigation pane of the Internet Information Services (IIS) Manager window, click the website. Then, click Bindings in the Actions column in the right-side pane.

    2. In the Site Bindings dialog box, select the binding that includes an empty Host Name parameter and click Remove to remove the binding. Retain the binding that includes the required domain name of the website.

      In this example, the binding that includes the domain name example.aliyundoc.com is retained, as shown in the following figure. 删除绑定网站的空主机头

    3. Use a malicious domain name or a domain name that does not have an ICP filing to access the website to check whether direct IP access to the website is disabled.

      If you cannot use the domain name to access the website as shown in the following figure even though the domain name is resolved to the IP address of the instance, direct IP access to the website is disabled. image

What do I do if an IIS website cannot be accessed because the IIS port is occupied by other processes?

Problem description

You cannot access an IIS website that is deployed on a Windows instance. When you run the netstat command on the instance, the command output indicates that the IIS port is in the LISTENING state and that the website process is in the Running state.

Cause

The preceding issue occurs because the IIS port is occupied by other processes.

Solution

Note

In this example, port 80 is used as the IIS port and an instance that runs Windows Server 2019 Datacenter 64-bit (English) is used. The operations that you must perform may vary based on the IIS port and the operating system of your instance.

  1. Connect to the Windows instance.

    For more information, see Connection methods.

  2. In the search box, enter cmd. In the search results, click Command Prompt.

    20230120131443
  3. Run the netstat -ano | findstr 80 command to check whether the IIS port is in the LISTENING state.

    The following figure shows a sample command output that indicates that a process whose process ID (PID) is 4 occupies IIS port 80.

    Check whether port 80 is in the LISTENING state
    • Port 80 in the LISTENING state:

      If port 80 is in the LISTENING state, the port may be occupied by another process. You can run the taskkill <PID> command to terminate the process, and then restart IIS.

      In this example, run the taskkill 4 command to terminate the process that occupies port 80 and then restart IIS.

      Note

      Set <PID> to the PID of the process that you want to terminate.

    • Port 80 not in the LISTENING state:

      If port 80 is not in the LISTENING state, rerun IIS or check whether the website is in the Running state.

  4. Access the website again.

    If the issue is resolved, you can access the website.