5

HttpPlatformHandler (バージョン 1.2) を使用して、IIS (IIS 10.0) で実行される基本的な Suave アプリケーションを取得しようとしています。

次のような単一のWebPartを返すと

(OK "Hello World")

アプリケーションは IIS で正常に動作し、http://localhost/testappで名前を指定して要求を行うことができます(testapp は、既定の Web サイトでのアプリケーションの名前です)。

ただし、次のような WebPart にもっと複雑なものを使用すると、

let app =
    choose
        [ GET >=> choose
            [ path "/hello" >=> OK "Hello GET"
              path "/goodbye" >=> OK "Good bye GET" ]
          POST >=> choose
            [ path "/hello" >=> OK "Hello POST"
              path "/goodbye" >=> OK "Good bye POST" ] ]

Web サイトは起動しますが、アプリケーション名でアクセスできません。ただし、ポートからはまだアクセスできます。

名前でアプリケーションをヒットすると、HTTP 503.2 (不正なゲートウェイ) 応答を受け取ります。

アプリケーションは、HttpPlatformHandler によって実行される FAKE スクリプトから開始されます。

コンテキストとして、これはアプリケーションを開始する FAKE スクリプトです。

#r "./tools/FakeLib.dll"
#r "Suave.dll"

open System
open Suave
open Suave.Successful
open Fake
open System.Net
open Suave.Filters
open Suave.Sockets
open Suave.Operators
open System.IO

Environment.CurrentDirectory <- __SOURCE_DIRECTORY__

let port = Sockets.Port.Parse <| getBuildParamOrDefault "port" "8083"

let serverConfig = 
    { defaultConfig with
       logger = Logging.Loggers.saneDefaultsFor Logging.LogLevel.Verbose
       bindings = [ HttpBinding.mk HTTP IPAddress.Loopback port ]
    }

let app =
  choose
    [ GET >=> choose
        [ path "/hello" >=> OK "Hello GET"
          path "/goodbye" >=> OK "Good bye GET" ]
      POST >=> choose
        [ path "/hello" >=> OK "Hello POST"
          path "/goodbye" >=> OK "Good bye POST" ] ]

startWebServer serverConfig (OK "Hello")
//startWebServer serverConfig app

上記のスクリプトは期待どおりに機能します。ただし、app WebPart代わりにを使用する(OK "Hello")と、上記の問題が発生します。

完全を期すために、HttpPlatformHandler 用に設定された web.config を次に示します。

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <remove name="httpplatformhandler" />
      <add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
    </handlers>
    <httpPlatform
              stdoutLogEnabled="true" startupTimeLimit="20"
              processPath=".\tools\FAKE.exe"
              arguments=".\test.fsx port=%HTTP_PLATFORM_PORT%" >
      <environmentVariables>
      </environmentVariables>
    </httpPlatform>
  </system.webServer>
</configuration>

ログを確認しましたが、残念ながらエラーを示すものは何も見当たりません。

イベント ビューアーを確認しましたが、何か問題がある可能性を示す唯一の手がかりは、アプリケーション ログの次の情報イベントです。

The description for Event ID 1001 from source HttpPlatformHandler cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

アプリが期待どおりに実行された場合のログの一部を次に示します (なしchoose):

[V] 2016-01-19T02:43:40.6932823Z: initialising BufferManager with 827392 bytes [Suave.Socket.BufferManager]
[I] 2016-01-19T02:43:40.7114149Z: listener started in 20.885 ms with binding 127.0.0.1:18450 [Suave.Tcp.tcpIpServer]
[V] 2016-01-19T02:43:40.8146603Z: 127.0.0.1 connected, total: 1 clients [Suave.Tcp.job]
[V] 2016-01-19T02:43:40.8166665Z: reserving buffer: 811008, free count: 99 [Suave.Tcp.job] [Suave.Socket.BufferManager]
[V] 2016-01-19T02:43:40.8217965Z: -> processor [Suave.Web.httpLoop.loop]
[V] 2016-01-19T02:43:40.8228181Z: reading first line of request [Suave.Web.processRequest]
[V] 2016-01-19T02:43:40.8378128Z: reserving buffer: 802816, free count: 98 [Suave.Web.readMoreData] [Suave.Socket.BufferManager]
[V] 2016-01-19T02:43:40.8498033Z: reading headers [Suave.Web.processRequest]
[V] 2016-01-19T02:43:40.8776578Z: freeing buffer: 802816, free count: 99 [Suave.Web.split] [Suave.Socket.BufferManager]
[V] 2016-01-19T02:43:40.8866594Z: parsing post data [Suave.Web.processRequest]
[V] 2016-01-19T02:43:40.8886553Z: <- processor [Suave.Web.httpLoop.loop]
[V] 2016-01-19T02:43:40.9057610Z: 'Connection: keep-alive' recurse [Suave.Web.httpLoop.loop]
[V] 2016-01-19T02:43:40.9057610Z: -> processor [Suave.Web.httpLoop.loop]
[V] 2016-01-19T02:43:40.9057610Z: reading first line of request [Suave.Web.processRequest]
[V] 2016-01-19T02:43:40.9057610Z: reserving buffer: 802816, free count: 98 [Suave.Web.readMoreData] [Suave.Socket.BufferManager]
[V] 2016-01-19T02:43:45.2531307Z: reading headers [Suave.Web.processRequest]
[V] 2016-01-19T02:43:45.2541141Z: freeing buffer: 802816, free count: 99 [Suave.Web.split] [Suave.Socket.BufferManager]
[V] 2016-01-19T02:43:45.2541141Z: parsing post data [Suave.Web.processRequest]
[V] 2016-01-19T02:43:45.2541141Z: <- processor [Suave.Web.httpLoop.loop]
[V] 2016-01-19T02:43:45.2551164Z: 'Connection: keep-alive' recurse [Suave.Web.httpLoop.loop]

そして、アプリが期待どおりに動作しないログの一部を次に示します (ルーティングを介してchoose):

[V] 2016-01-19T02:44:59.6356127Z: initialising BufferManager with 827392 bytes [Suave.Socket.BufferManager]
[I] 2016-01-19T02:44:59.6537478Z: listener started in 20.987 ms with binding 127.0.0.1:18708 [Suave.Tcp.tcpIpServer]
[V] 2016-01-19T02:44:59.8848907Z: 127.0.0.1 connected, total: 1 clients [Suave.Tcp.job]
[V] 2016-01-19T02:44:59.8879891Z: reserving buffer: 811008, free count: 99 [Suave.Tcp.job] [Suave.Socket.BufferManager]
[V] 2016-01-19T02:44:59.8929862Z: -> processor [Suave.Web.httpLoop.loop]
[V] 2016-01-19T02:44:59.8939749Z: reading first line of request [Suave.Web.processRequest]
[V] 2016-01-19T02:44:59.9068548Z: reserving buffer: 802816, free count: 98 [Suave.Web.readMoreData] [Suave.Socket.BufferManager]
[V] 2016-01-19T02:44:59.9209857Z: reading headers [Suave.Web.processRequest]
[V] 2016-01-19T02:44:59.9259688Z: freeing buffer: 802816, free count: 99 [Suave.Web.split] [Suave.Socket.BufferManager]
[V] 2016-01-19T02:44:59.9338521Z: parsing post data [Suave.Web.processRequest]
[V] 2016-01-19T02:44:59.9378580Z: <- processor [Suave.Web.httpLoop.loop]
[V] 2016-01-19T02:44:59.9518518Z: freeing buffer: 811008, free count: 100 [Suave.Tcp.job] [Suave.Socket.BufferManager]
[V] 2016-01-19T02:44:59.9518518Z: Shutting down transport. [Suave.Tcp.job]
[V] 2016-01-19T02:44:59.9528516Z: 127.0.0.1 disconnected, total: 0 clients [Suave.Tcp.job]

アプリが実行されると、接続が開き、すぐに閉じます。ポートでアプリをヒットすると、新しい接続が開き、すぐに閉じます(再び)。

アプリのホスト構成に何か問題がありますか、または選択機能の使用方法に何か不足していますか? どんな助けでも大歓迎です。ありがとうございました!

4

1 に答える 1

4

ルートは次のようになるはずです:

path "/app/hello"

于 2016-01-21T01:10:34.000 に答える