https://github.com/Azure/azure-websites-java-remote-debugging
Just do the work here.
Open the WebApp application settings from the Azure portal and leave "WebSockets" turned on.
This setting is required because it communicates with the remote via WebSocket when debugging.
site \ wwwroot \ web.config
on the App Service.It's easy to access and create kudu, which is dying behind the WebApp.
kudu is roughly the software that supports AppService behind the scenes, taking care of deployment control, WebJobs operation, etc., and using it from a browser that is convenient for development. We also provide a console that you can do.
--Open your browser and go to https://YOURAPP.scm.azurewebsites.net/DebugConsole
-(* YOURAPP
is the name when creating the WebApp resource. It is good to remember that scm is just inserted between the public URLs.)
--Move to site
→ wwwroot
--Create a web.config
file with" New File "from the[+]
icon.
--The part of % programfiles (x86)%
is for 32bit and different for 64bit. (32bit for cheap plans such as Free)
--ʻApache-tomcat-8.0.46` part changes depending on the version of tomcat.
web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httppPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="%programfiles(x86)%\apache-tomcat-8.0.46\bin\startup.bat">
<environmentVariables>
<environmentVariable name="CATALINA_HOME" value="%programfiles(x86)%\apache-tomcat-8.0.46"/>
<environmentVariable name="JAVA_OPTS" value="-Djava.net.preferIPv4Stack=true -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=127.0.0.1:%HTTP_PLATFORM_DEBUG_PORT%"/>
<environmentVariable name="CATALINA_OPTS" value="-Dport.http=%HTTP_PLATFORM_PORT%"/>
</environmentVariables>
</httpPlatform>
</system.webServer>
</configuration>
Reboot from the portal.
After restarting, access once and keep the Java process running. Can be confirmed with Process Explorer on kudu
This is the end of the work on the WebApp side.
From here, work on the local machine.
Download the DebugSession client from https://github.com/Azure/azure-websites-java-remote-debugging/releases.
Start by giving the following arguments to DebugSessin.bat in bin. Set the environment variable JAVA_HOME
.
-s
, -u
and -w
as appropriate.DebugSession.bat ^
--auto ^
-p 8000 ^
-s YOURAPP.scm.azurewebsites.net ^
-u $YOURAPP ^
-w ****
Info: Waiting for debugger to connect on 8000 ...
If it says ..., you're ready to go.
For connection information (Publish URL / User / Pass), if you use Azure CLI, you can use the value of MS Deploy
obtained around ʻaz webapp deployment list-publishing-profiles ...`.
After that, remote debugging can be performed by connecting to the DebugSession client (localhost: 8080) from a debugger on Eclipse.
However, since it is remote, the operation is sluggish. (Maybe because it was a free plan.)
Recommended Posts