1

I have read every thread/blog I can find regarding the httpplatformhandler product but I am still unsure if I am able to host a Sinatra (NON ruby on rails) app in IIS using the HttpPlatformHandler. Is this possible? I see examples for rails, but I am not sure how to alter to allow plain Ruby/Sinatra. I am unsure if I need puma or some other "middle man" to do this. If this is possible, would someone kindly provide an example of a web.config that would work for the default Sinatra app:

require 'sinatra'

get '/hi' do "Hello World!" end

Lex Li
  • 60,503
  • 9
  • 116
  • 147
Charlie Baum
  • 107
  • 1
  • 3
  • 15

1 Answers1

1

This works for my rails application - sinatra should not be any diffrerent. Just change the path to your ruby binaries... EnvironmentVariables for HOME/HOMEDRIVE/HOMEPATH are necessery on a windows server environment using Active Directory users. You can ignore this on a single local machine.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" requireAccess="Script" />
       </handlers>
        <httpPlatform stdoutLogEnabled="true" processesPerApplication="1" stdoutLogFile="C:\inetpub\wwwroot\rails\FrontEndServer\log\rails.log" startupTimeLimit="20" processPath="C:\RailsInstaller\Ruby2.3.0\bin\ruby.exe"
                      arguments="&quot;C:\RailsInstaller\Ruby2.3.0\bin\puma&quot; --env production --dir &quot;C:\inetpub\wwwroot\rails\FrontEndServer&quot; -p %HTTP_PLATFORM_PORT% ">
            <environmentVariables>
                <environmentVariable name="HOME" value="C:\temp"/>
                <environmentVariable name="HOMEDRIVE" value="C:\temp"/>
                <environmentVariable name="HOMEPATH" value="C:\temp"/>
            </environmentVariables>
        </httpPlatform>
    </system.webServer>
</configuration>