Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
托管在IIS上且带有HttpPlatformHandler的Suave应用程序关闭连接_Iis_F#_Suave - Fatal编程技术网

托管在IIS上且带有HttpPlatformHandler的Suave应用程序关闭连接

托管在IIS上且带有HttpPlatformHandler的Suave应用程序关闭连接,iis,f#,suave,Iis,F#,Suave,我正在尝试使用HttpPlatformHandler(版本1.2)在IIS(IIS 10.0)中运行一个基本的Suave应用程序 当我让它返回单个Web部件时,例如 (OK "Hello World") let app = choose [ GET >=> choose [ path "/hello" >=> OK "Hello GET" path "/goodbye" >=> OK

我正在尝试使用HttpPlatformHandler(版本1.2)在IIS(IIS 10.0)中运行一个基本的Suave应用程序

当我让它返回单个Web部件时,例如

(OK "Hello World")
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" ] ]
该应用程序在IIS中运行良好,我可以在(testapp是默认网站下应用程序的名称)按名称向其发出请求

但是,如果我对Web部件使用更复杂的东西,例如

(OK "Hello World")
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" ] ]
网站启动了,但我无法通过应用程序名访问它。不过,我仍然可以通过港口到达

当我按名称点击应用程序时,我收到一个HTTP 503.2(坏网关)响应

应用程序是从HttpPlatformHandler执行的伪脚本启动的

对于上下文,这是启动应用程序的假脚本:

#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
我已经查看了日志,但不幸的是,我看不到任何指示错误的内容

我检查了事件查看器,发现可能有问题的唯一线索是应用程序日志中的此信息事件:

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
):

当应用程序执行时,连接会立即打开然后关闭。当我通过端口点击应用程序时,一个新的连接打开,然后立即(再次)关闭


我是否在应用程序的主机配置方面出错,或者在如何使用choose功能时遗漏了什么?任何帮助都将不胜感激。谢谢大家!

我认为路线应该是这样的:


path”/app/hello“

是否尝试附加调试器?有例外吗?如果您将Suave日志重定向到一个文件或类似的文件,会显示什么吗?谢谢您的回复(和询问)。我可以在FAKE.exe运行后附加到它,但在它启动之前我无法附加到它。我无法检测到异常。我编辑了问题以包含日志输出。因此,如果在进程启动后附加到该进程,您是否会看到任何异常?很遗憾,我没有看到。当我通过端口访问应用程序时,我可以访问断点,但当我通过名称访问应用程序时,我立即从IIS获得502.3错误网关响应。就是这样。路径是相对于根的,并且与它们所在的目录不匹配。非常感谢。同时,我也向大卫·哈尼(David Haney)大声呼喊,感谢他在推特上伸出援手。作为旁白,我查了一下。它在AbsolutePath上匹配,因此如果请求是localhost/hello,那么它将查找“/hello”。
[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]