WebAPI No action was found on the controller 'xxx' that matches the name 'zzzz'.

Micheale See 1 Reputation point
2022-02-17T02:13:05.237+00:00

Hi All,

Warmest regards. I need help.

I having error when deploy the site to Portal Azure VM Apps:-

<Error>
<Message>No HTTP resource was found that matches the request URI 'http://xxxx.xxxx.com/api/v1/keys/24818/ReadKeyServiceAgreements'.</Message>
<MessageDetail>No action was found on the controller 'keys' that matches the name 'ReadKeyServiceAgreements'.</MessageDetail>
</Error>

But, I can run using Visual Studio Debugger without any error & I am able to get the result. [http://localhost:9001/api/v1/keys/24818/ReadKeyServiceAgreements]
Please advise.

I have Global.asax.cs:-

public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.IgnoreRoute("help");
            routes.MapHttpRoute("KeysActionRoute", "keys/{serialNumber}/{action}", new { controller = "keys" });

My Controller KeysController.cs

:
:
/// <summary>
    /// Responds to web service requests for keys.
    /// </summary>
    public class KeysController : ApiController
    {
:
:

/// <summary>
        /// Read a key detail.
        /// </summary>
        /// <param name="serialNumber">
        /// The serial number of the key.
        /// </param>
        [HttpGet]
        public string ReadKeyDetail(string serialNumber)
        {
            var data = dataAccess.ReadMergedSitesKeysAndLicenses(serialNumber);
            return JsonConvert.SerializeObject(data);
        }

Please advise.
Thanks

Regards,
Micheale

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,518 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Micheale See 1 Reputation point
    2022-02-17T05:19:56.857+00:00

    Hi,

    Sorry. Issue resolved. Not sure why Visual Studio Publish the Site to .zip & install into Azure VM Server for the web apps. The bin folder not updated. Something wrong with Visual Studio 2019 Build > Publish function. I even try Clean > Rebuild & Publish also no luck. At the end. I manually delete the bin folder from my work project folder & rebuild. Manually zip the bin files under debug & upload to fileserver. Then I remote to Azure VM, download the bin folder & replaced inetpub/wwwroot/projectFolder/<<replaced the bin folder. It's work like a charm.

    I can't explained why. I think Visual Studio 2019 Publish functionality not really working well. I hope Visual Studio teams can improve on this. Make sure bin folder delete off, rebuild before publish the package automatically at behind code when user hitting Publish.

    Thanks.

    Regards,
    Micheale

    0 comments No comments

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.