0

I host a webapp on TomEE and want it available from a front-end IIS Server (same server).

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 http://localhost:8080/myapp/ (before further change to the port number)
  • Virtual Directory named "myapp", with physical path "C:\tomee\iis_virtual_directory"

I need to access to MyApp with an URL like https://myserver.mydomain.tld/myapp/, but that doesn't work right now, Tomcat isn't even starting, I get a 502.3 Bad Gateway error.

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="*" 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">

I managed to get it working only when I put these web.config parameters inside the main web.config file in c:\inetpub\wwwroot, but then the main ASP.Net app wasn't available anymore.

Then i changed path attribute this way :

<add name="httpplatformhandler" path="myapp/*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />

And both apps are available. But I wonder : what am I missing ? why can't i use a web.config file inside Virtual Directory ? At this point the Virtual Directory is useless and I can delete it without breaking access to MyApp.

asked Jan 23, 2025 at 14:39
4
  • have you tried to use the path as application instead of the virtual directory Commented Jan 24, 2025 at 1:50
  • you mean convert virtual directory to application ? I thought I could do that only if it is an ASP.NET app. Commented Jan 24, 2025 at 7:54
  • another thing you could try is that set the inheritance to false: <location path="." inheritInChildApplications="false"> Commented Jan 24, 2025 at 7:55
  • choose like this in the iis to convert virtual directory to application image Commented Jan 24, 2025 at 7:58

1 Answer 1

0

Thanks to Jalpa Panchal comment, i made it work as intended. I converted virtual directory to application in IIS Manager, and voila. Not sure why that didn't work before though.

answered Jan 24, 2025 at 9:00
Sign up to request clarification or add additional context in comments.

1 Comment

the config file setting was not getting applied to the virtual directory so i suggest you to add the location path to apply or the other way to convert to the application that way application can get the correct configuration setting for the specific site or application

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.