To access my api I have to use the following url https://{mywebsite}.azurewebsites.net/api/api/ping

Henry Petersen 41 Reputation points
2022-09-07T21:50:11.857+00:00

I have spa and have created a virtual application
Virtual Path: /api
Physical Path site\api

To access the api the url is https://{mywebsite}.azurewebsites.net/api/api/ping. I don't understand the double api reference in the url why is not just /api/ping?

Thanks

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,831 questions
0 comments No comments
{count} votes

Accepted answer
  1. Takahito Iwasa 4,841 Reputation points MVP
    2022-09-07T22:33:06.427+00:00

    Hi, @Henry Petersen

    Are you putting the files in site\api instead of site\wwwroot\api ?

    When I put the files under site\wwwroot and pointed to the virtual application site\wwwroot\api it worked fine.
    What is your App Service configuration information and the structure of the uploaded file?

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Henry Petersen 41 Reputation points
    2022-09-08T11:03:15.49+00:00

    corrected my path to 'site/wwwroot/api', updated my publishing profile to include /api in the Site Name. That published the api to correct folder finally, but was still having the same issue with having to reference '{my web site}/api/api/ping'. Finally determined it had to be something in the code itself and sure enough the Route in the api controller was referencing 'api/[controller]'. Changed that to '[controller]' and all works perfectly now.

    0 comments No comments