Testing application endpoint inside a Windows container
search cancel

Testing application endpoint inside a Windows container

book

Article ID: 403399

calendar_today

Updated On:

Products

VMware Tanzu Platform

Issue/Introduction

You are hitting a non successful response code and the best to troubleshoot is to take steps here:

How to troubleshoot app access issues in VMware Tanzu Application Service (TAS) for VMs

But the KB above is more for a linux based diego cell. This KB will show you how to test application endpoint inside a Windows Diego Cell.

Environment

VMware Tanzu Application Service (TAS) for VMs [Windows]

Cause

 

Resolution

To test your application endpoints inside Windows Diego Cell

 

1. Login into Windows Diego Cell as root. See link below with note on the Windows Diego Cell section

How to login to an app container as a root in Tanzu Application Service for VMs

2. Once you are in the Powershell, you can use command:

  • to check for ports and the PIDs running on that particular port
PS C:\> netstat -aon

Active Connections

Proto  Local Address          Foreign Address        State           PID

TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       13868
TCP    0.0.0.0:2222           0.0.0.0:0              LISTENING       15860
TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING       4604
TCP    0.0.0.0:49152          0.0.0.0:0              LISTENING       12156
TCP    0.0.0.0:49153          0.0.0.0:0              LISTENING       17684
TCP    0.0.0.0:49154          0.0.0.0:0              LISTENING       14236
TCP    0.0.0.0:49155          0.0.0.0:0              LISTENING       17260
TCP    0.0.0.0:49178          0.0.0.0:0              LISTENING       20388
TCP    [::]:135               [::]:0                 LISTENING       13868
TCP    [::]:2222              [::]:0                 LISTENING       15860
TCP    [::]:8080              [::]:0                 LISTENING       4604
TCP    [::]:49152             [::]:0                 LISTENING       12156
TCP    [::]:49153             [::]:0                 LISTENING       17684


  • you can check the PIDs against running processes, on this example your deployed app is running on port 8080 with process id 4604
PS C:\> get-Process                                                                                                                              

get-Process                                                                                                                                      

Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName                                                                            

-------  ------    -----      -----     ------     --  -- -----------                                                                          
    151       7     3184       6464       3.17  17600   2 CExecSvc
    227      11     1960       5200       1.61   8636   2 csrss
    310      21    44460      57648   2,368.56  15860   2 diego-sshd
   64       7     1144       3992       0.02  13224   2 fontdrvhost                                                        
1351     162   205684     295820  18,316.06   4604   2 <your-app>
 
90       8    13988       5616       2.25  18272   2 garden-init
    0       0       56          8                 0   0 Idle
   
302      21    43856      50188   2,474.02   8960   2 launcher
   805      24     6616      29464       5.72  20388   2 lsass
 764      54    94708     115592       5.97  52416   2 powershell
 187      10     2360       6684      19.27  14236   2 services
   50       3      504       1220       0.05  19920   0 smss     
 353      28     5932      30124     618.19   9236   2 svchost
 348      13     3628      21544       1.30  11864   2 svchost   
  • You can invoke application endpoints using PowerShell Invoke-RestMethod or Invoke-WebRequest cmdlet.
Invoke-RestMethod -Uri "http://localhost:8080/your-app/?param1=value1&param2=value2" -Method Get            

<!DOCTYPE html>

<html lang="en">

<head>

<noscript>
   <meta http-equiv="refresh" content="0; URL=/your-app/?param1=value1&param2=value2" />
</noscript>
<base href="/your-app/" />
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="####">                                                                                  
   ....
</head>
 
<body>
....   

</body>
Example of non-successful response code
 
PS C:\> Invoke-WebRequest -Uri "http://localhost:8080/your-app/non-existing-endpoint"
Invoke-WebRequest -Uri "http://localhost:8080/your-app/non-existing-endpoint"
Invoke-WebRequest : The remote server returned an error: (404) Not Found.