Why SharePoint rest Apis are not working from web server URL but does work from app server URL?

Sudhir Singare 80 Reputation points
2025-03-18T09:47:52.98+00:00

We have 2 servers in SharePoint farm.

  1. SP App with Search.
  2. Front end web server.

Now when we try https://appserver001/_api/site it works fine.

But I try https://webserver001/_api/site it gives us below error:

The Web application at http://webserver001:80/_api/site could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

This issue is casing 500 errors while performing any activities when we use web server URL, and we need to use web server URL in load balancer, so we need to fix this issue

Can you suggest steps that could resolve this issue also let us know if any more information is required.

Thanks In Advance.

Microsoft 365 and Office | SharePoint Server | For business
0 comments No comments
{count} votes

Accepted answer
  1. Yanli Jiang - MSFT 31,596 Reputation points Microsoft External Staff
    2025-03-19T02:46:20.7033333+00:00

    Hi @Sudhir Singare ,

    Good days, thanks for querying in this forum. We’re happy to help you.

    Based on the error message you're experiencing when trying to access the URL on the front-end web server, it sounds like the web server might not be correctly configured to handle the requests or it might not have the proper services running. Here’s a series of steps you can follow to troubleshoot and resolve the issue:

    1. Verify Alternate Access Mappings (AAM)

    1. Log in to SharePoint Central Administration.
    2. Navigate to Central Administration -> System Settings -> Configure alternate access mappings.
    3. Check if the URLs you are using are correctly mapped under the expected zones (Default, Intranet, Internet, etc.). - If not, edit the mappings to ensure both https://appserver001 and https://webserver001 are properly mapped.

    2. Check Service Application Associations

    1. Log in to SharePoint Central Administration.
    2. Navigate to Central Administration -> Application Management -> Manage web applications.
    3. Select the web application you are targeting (e.g., SharePoint - 80).
    4. In the Ribbon, click on Service Connections.
    5. Ensure that the necessary service applications (like Search Service Application) are selected for your web application.

    3. Verify Web Configurations

    1. Open the web.config file located in the \inetpub\wwwroot\wss\VirtualDirectories\[your web app port] on both the app server and the web server.
    2. Compare the web.config files to ensure they are identical. - Look for any missing entries or discrepancies between the configurations, especially custom configurations or additional modules.

    4. Ensure Services are Running on Web Server

    1. Log in to SharePoint Central Administration.
    2. Navigate to Manage services on server under System Settings.
    3. Ensure the front-end web server role is selected for the server.
    4. Verify that essential services like Microsoft SharePoint Foundation Web Application are started.
    5. Repeat this check on both the app server and web server.

    5. Review IIS Bindings and Site Settings

    1. Open Internet Information Services (IIS) Manager on the web server.
    2. Expand Sites and click on your SharePoint site.
    3. In the right pane, click on Bindings.
    4. Ensure that the correct bindings (http/https) are present and correct, matching those on the app server.
    5. Also, check the Advanced Settings of the site to ensure there are no conflicts.
    6. Make sure the site is started and running properly.

    6. Ensure Hosts File Entries

    1. Open the hosts file on both servers located at C:\Windows\System32\drivers\etc\hosts.
    2. Verify that the file contains correct entries for both servers: [app server IP] appserver001 [web server IP] webserver001
    3. Add missing entries if necessary and save the file, using administrative privileges.

    7. Review ULS Logs

    1. Navigate to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS (the path might differ slightly depending on your SharePoint version).
    2. Open the latest log files using a ULS viewer or a text editor.
    3. Look for entries around the time when the error occurs, focusing on Critical and Unexpected entries.
    4. Identify specific error messages or stack traces that might provide more information.

    8. IIS Reset and Cache Clearing

    IIS Reset

    1. Open Command Prompt with administrative privileges.
    2. Execute the command: iisreset

    Clear SharePoint Configuration Cache

    1. Stop the SharePoint Timer Service (SPTimerV4) from the Services console.
    2. Navigate to C:\ProgramData\Microsoft\SharePoint\Config\ and find the folder with a GUID name.
    3. Back up the folder just in case.
    4. Delete all XML files inside the GUID-named folder, but do not delete the folder itself or the cache.ini file.
    5. Edit the cache.ini file and set its value to 1.
    6. Start the SharePoint Timer Service again.

    9. Check Load Balancer Configuration

    1. Verify that the load balancer has the correct URL mappings and health checks configured.
    2. Ensure that requests are correctly routing to the web server URL.
    3. Check if sticky sessions (session persistence) are correctly configured if required for your application.
    4. Test if direct access to https://webserver001 works without going through the load balancer to isolate the issue.

    Hope these information helps.

    Please do let us know if you have any further queries.

    Kindly consider accepting the answer if the information provided is helpful. This can assist other community members in resolving similar issues.


1 additional answer

Sort by: Most helpful
  1. Sudhir Singare 80 Reputation points
    2025-03-24T11:28:09.4466667+00:00

    For those curious, this was resolved by some changes in AAM.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.