小编Mah*_*yed的帖子

HttpPlatformHandler HTTP错误502.3 - 错误的网关

我试图在IIS上运行的轨道,我也跟着提到的步骤在这里由Scott Hanselman的.

以下是一些可能有用的信息:

  • Rails版本:5.1.4
  • Ruby版本:2.3.3

在我按照设置步骤操作后,我反驳了这个问题

HTTP错误502.3 - 错误的网关

尝试路由请求时出现连接错误.

最可能的原因:

  • CGI应用程序未返回有效的HTTP错误集.

  • 由于父网关中的错误,充当代理或网关的服务器无法处理请求.

你可以尝试的事情:

  • 使用DebugDiag对CGI应用程序进行故障排除.

  • 确定代理或网关是否应对此错误负责.

这是我的web.config文件内容.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" requireAccess="Script" />
    </handlers>
    <httpPlatform processPath="C:\RailsInstaller\Ruby2.3.3\bin\ruby.exe" arguments="&quot;C:\RailsInstaller\Ruby2.3.3\bin\rails&quot; server -p %HTTP_PLATFORM_PORT% -b 127.0.0.1" startupTimeLimit="200" stdoutLogEnabled="true" stdoutLogFile="rails.log">
      <environmentVariables>
        <environmentVariable name="RAILS_ENV" value="development" />
      </environmentVariables>
    </httpPlatform>
    <directoryBrowse enabled="true" showFlags="Date, Time, Size, Extension" />
  </system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

我不确定问题是什么,我想念的配置是什么!

ruby iis cgi ruby-on-rails

10
推荐指数
1
解决办法
710
查看次数

rails如何区分用户/:id和用户/新路由?

我试图了解rails如何知道两条路线之间的区别

GET /users/:id

和

GET /users/new

当我们打字

resources :users

我试图跟踪并理解rails源代码中的资源方法,但我完全不了解它.

    def resources(*resources, &block)
      options = resources.extract_options!.dup

      if apply_common_behavior_for(:resources, resources, options, &block)
        return self
      end

      with_scope_level(:resources) do
        options = apply_action_options options
        resource_scope(Resource.new(resources.pop, api_only?, @scope[:shallow], options)) do
          yield if block_given?

          concerns(options[:concerns]) if options[:concerns]

          collection do
            get  :index if parent_resource.actions.include?(:index)
            post :create if parent_resource.actions.include?(:create)
          end

          new do
            get :new
          end if parent_resource.actions.include?(:new)

          set_member_mappings_for_resource
        end
      end

      self
    end
Run Code Online (Sandbox Code Playgroud)

下面的代码是那样做的吗?

     new do
       get :new
     end if parent_resource.actions.include?(:new)
Run Code Online (Sandbox Code Playgroud)

如果有,你能解释一下吗?

另外,如果我试着写用相同的另一条路线GET users/new重定向到的格式GET users/:id,所以我怎么能写这样另一条路线 …

ruby routes ruby-on-rails

0
推荐指数
1
解决办法
69
查看次数

标签 统计

ruby ×2

ruby-on-rails ×2

cgi ×1

iis ×1

routes ×1