【问题标题】:Host Sinatra app in IIS with HttpPlatformHandler使用 HttpPlatformHandler 在 IIS 中托管 Sinatra 应用程序
【发布时间】:2015-07-08 18:52:17
【问题描述】:

我已经阅读了我能找到的关于 httpplatformhandler 产品的所有线程/博客,但我仍然不确定我是否能够使用 HttpPlatformHandler 在 IIS 中托管 Sinatra(非 ruby​​ on rails)应用程序。这可能吗?我看到了 rails 的示例,但我不确定如何更改以允许普通的 Ruby/Sinatra。我不确定我是否需要 puma 或其他一些“中间人”来做到这一点。如果可能的话,有人愿意提供一个适用于默认 Sinatra 应用程序的 web.config 示例吗:

需要'sinatra'

get '/hi' 做 “你好世界!” 结束

【问题讨论】:

    标签: ruby iis sinatra


    【解决方案1】:

    这适用于我的 rails 应用程序 - sinatra 不应该有任何不同。只需更改 ruby​​ 二进制文件的路径... HOME/HOMEDRIVE/HOMEPATH 的 EnvironmentVariables 在使用 Active Directory 用户的 Windows 服务器环境中是必需的。你可以在一台本地机器上忽略它。

    <?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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多