Which handler is preferred to host golang api as app service?

Tanul 1,251 Reputation points
2021-02-01T20:14:18.86+00:00

Team,

I've hosted golang app following this link. The handler chose in web.config is httpplatformhandler.As far as I know this handler is replaced with AspNetCoreModuleV2 for .net core. Is there any updated handler available to deploy golang app in production.

I have also tried these two AspNetCoreModule and AspNetCoreModuleV2 and both are working perfectly.

I would be grateful if someone suggest if any changes required or best practices for golang as app service in production.

Currently, I don't have K8s or openshift.

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

Accepted answer
  1. ajkuma 22,076 Reputation points Microsoft Employee
    2021-02-08T19:19:12.647+00:00

    To benefit the community, summarizing the answer from our discussion above (via 'comments'):

    For .net core use ASPNetCoreModulev2, for node js use iis node and for all other use HTTPPlatformHandler.
    ASPNETCoreModule handler is specific for running .NET core/.NET 5, not for general use. HttpPlatformHandler is the recommended proxy.

    So, the best approach would be to use something like this:

     <handlers>  
     <add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />  
     </handlers>  
      <httpPlatform processPath=".\Dev.exe" startupTimeLimit="60" />  
    

    Additional info:

    ASPNetCoreModule is just another module with the handler can leverage to process incoming requests. Typically, the concept of HTTP Handler and HTTP modules is that a module would pass the request to the specific Handler. So, for ASP.NET Core, the handler that handles the request is ASPNetCoreModule. Eg for other language; for Node on Windows, it’s IISNode. Similarly, for GoLang we will have to give the appropriate handler.

    You could just define the handler that takes in the Go requests and processes them.

    Kindly check this template source -Create a web app on Azure with GoLang extension -check the transform, and try something similar in a web.config of yours and run a hello world GoLong test app.

    More Info:

    In -process vs out-process would simply mean that the configured handler (executable) runs within the w3wp.exe process vs the executable running as a child process of w3wp.exe.
    For GoLang, I believe the respective process would run out-of-process which is as a child process of w3wp.exe.
    httpplatformhandler, can either be in-process or out-of-process, depending the application/config.

    Whereas the ASP.NET Core Module is a native IIS module that plugs into the IIS pipeline to either:
    -In-process hosting model, when you host an ASP.NET Core app inside of the IIS worker process (w3wp.exe).
    -Out-of-process hosting model.- forward web requests to a backend ASP.NET Core app running the Kestrel server.

    Check this doc for additional info.

    Thanks for the great question/feedback @Tanul , we appreciate the co-operation and follow-up on this.


0 additional answers

Sort by: Most helpful