So, for those people who don't have the money to purchase enough servers and software to run things on separate boxes (or even virtual machines) who want Exchange 2007 and Terminal Services Gateway TSG services on the same machine, here are some tips:
Outlook Anywhere uses the RPC/HTTP protocol, and so does the Gateway. I should had known but it took me a while to figure out they are not quite compatible. TSG requires NTLM authentication (Windows Authentication) while Outlook Anywhere if you are using ISA Server 2004 requires Basic Authentication. After reding this web page: http://technet.microsoft.com/en-us/library/aa998036(EXCHG.80).aspx I decided to use the command: Set-OutlookAnywhere -Name Server01 -IISAuthenticationMethod Basic,NTLM to set the authentication method to both, allowing them to work together
If you are using an ISA Server, I recommend you to read http://technet.microsoft.com/en-us/library/aa998036(EXCHG.80).aspx to better understand what kind of directories you'll have to publish. Using ISA Server 2006 would be easier but unfortunately I am force to run ISA 2004 for the time being.
Use the following line for a first time installation:
Enable-OutlookAnywhere -Server:CA01 -ExternalHostname:mail.contoso.com -ClientAuthenticationMethod:NTLM,Basic -SSLOffloading:$true