asp.net web api not working in iis

RAVI 1,076 Reputation points
2025-03-26T14:49:10.9766667+00:00

Hello

I have asp.net web api in local visual studio its runing fine the same i installed in IIS version 10.0.22621 with application pool 4.0 but its saying file or folder not found whats the issues

from visual studio on running if i type localhost/api/values/getdispatchdata showing data perfect the same file when i upload to iis its saying 404 - File or directory not found.

help me to solve this issues thanking you

Developer technologies | ASP.NET | ASP.NET API
{count} votes

Answer accepted by question author
  1. Anonymous
    2025-03-27T10:17:19.4366667+00:00

    Hi @RAVI,

    First of all, you should host your app in IIS, steps below:

    1. Open IIS, right-click on Sites and select Add WebSite....

    User's image

    1. Configure your website, enter the site name, select app pool and physical path of your project, and enter the port (Unused port number. Port 80 is already used by the default site). likes:

    User's image

    1. Browser your site, click option below:

    User's image

    The default page should now be the Index page. Add /api/values/getdispatchdata after the URL bar, press Enter and view the response result.

    Best regards,

    Xudong Peng


    If the answer is the right solution, please click "Accept Answer" and kindly upvote. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. RAVI 1,076 Reputation points
    2025-03-27T08:08:07.09+00:00

    This is my small webapi project

    https://www.transfernow.net/dl/202503277qoyov45

    In Local System its working fine if i open in browser http://localhost:49822/api/values/GetDispatchData

    When i move this all copy to IIS and convert to application and application pool set to 4.0 its not working there this is my iis version

    111


Your answer

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