0

I host a webapp on TomEE and can access it from a front-end IIS server, using httpPlatformHandler module.

My server is built this way :

  • Windows Server 2016
  • IIS 10 with httpPlatformHandler module v1.2 installed
  • TomEE 9.1.1 microprofile in "C:\tomee\apache-tomee-9.1.1-microprofile"
  • JDK 11.0.18 in "C:\tomee\jdk-11.0.18+10"
  • Main IIS ASP.Net app available at https://myserver.mydomain.tld/main/
  • MyApp.war deployed and available at https://myserver.mydomain.tld/myapp/
  • Application with alias "myapp", and physical path "C:\tomee\iis_virtual_directory"

I put this web.config file under "C:\tomee\iis_virtual_directory" :

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <add name="httpplatformhandler" path="myapp/*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
        </handlers>
        <httpPlatform processPath="C:\tomee\apache-tomee-9.1.1-microprofile\\bin\startup.bat" arguments="start" stdoutLogEnabled="true" stdoutLogFile="C:\tomee\iis_virtual_directory\log.txt">
            <environmentVariables>
                <environmentVariable name="JRE_HOME" value="C:\tomee\jdk-11.0.18+10" />
                <environmentVariable name="CATALINA_HOME" value="C:\tomee\apache-tomee-9.1.1-microprofile" />
                <environmentVariable name="CATALINA_OPTS" value="-Dport.http=%HTTP_PLATFORM_PORT%" />
            </environmentVariables>
        </httpPlatform>
    </system.webServer>
</configuration>

I also updated below attribute in TomEE server.xml

<Server port="-1" shutdown="SHUTDOWN">
<Connector port="${port.http}" protocol="HTTP/1.1">

My question is : what is the best/cleanest way to shutdown or restart the TomEE server, without restarting whole IIS server if possible ? I want to deploy new version of the app by pasting the WAR file in webapps folder, but app pool recycle doesn't seem to work, I had to delete app folder in order to really deploy it.

1
  • Hi Cyril, you can create 2 application pools which name are main_pool and myapp_pool manually. And use them for your 2 virtual applications. If you want to restart the myapp, you can recyle the myapp_pool. Commented Jan 24 at 12:17

1 Answer 1

0

If your goal is to restart the application, the healthiest method is to recycle from the application pool.

You can set it according to the maximum number of requests, according to a time, according to a timeout, or according to the cpu going over a certain threshold.

Or If you have the ability to run a bat file from your project, you can do it using appcmd.exe.

Example.

%windir%\system32\inetsrv\appcmd recycle apppool AppPoolName

You can also do it with Powershell;

Restart-WebAppPool (Get-Website -Name <IIS_SiteName>).applicationPool

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

Ok thanks but I have to edit in order to ask a slightly different question because this doesn't fullfill my goal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.