【发布时间】:2017-08-27 15:43:07
【问题描述】:
我花了一些时间搜索 Akka.NET F# API。找不到它,即使有很好的 C# 文档。我找到了下面的代码,日期为 2017 年 3 月,看起来不错,但不幸的是,当我尝试运行它时会产生异常。
两个问题:
1) 下面的代码有什么问题?
2) 是否有 Akka.Net F# API 的在线文档,如果有,在哪里?
观察:我尝试了其他几个我在网上找到的 F# Akka.NET sn-ps,它们都产生了异常。
代码的网址是:
https://www.seventeencups.net/building-a-mud-with-f-sharp-and-akka-net-part-one/
这是我尝试运行的代码:
open System
open Akka.Actor
open Akka.Configuration
open Akka.Remote
open Akka.FSharp
let system = System.create "system" (Configuration.defaultConfig())
type GreeterMsg =
| Hello of string
| Goodbye of string
let greeter = spawn system "greeter" <| fun mailbox ->
let rec loop() = actor {
let! msg = mailbox.Receive()
match msg with
| Hello name -> printf "Hello, %s!\n" name
| Goodbye name -> printf "Goodbye, %s!\n" name
return! loop()
}
loop()
异常消息包括以下内容:
System.TypeLoadException: Method 'WatchWith' in type '-ctor@270' from assembly 'Akka.FSharp, Version=1.2.3.41, Culture=neutral, PublicKeyToken=null' does not have an implementation
【问题讨论】: