我花了一些时间搜索Akka.NET F#应用程序接口。找不到它,即使有很好的C#文档。我发现下面的代码,日期为2017年3月,看起来不错,但不幸的是,当我试图运行它时会产生一个异常。
两个问题:
1)下面的代码有什么问题?
2)是否有Akka.Net F#应用编程接口的在线文档,如果有,在哪里?
观察:我尝试了其他几个我在网上找到的F# Akka.NET片段,所有这些片段都产生了异常。
代码的URL为:
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
发布于 2017-08-28 01:35:35
Akka.NET v1.3中引入了WatchWith方法,而您使用的是Akka.FSharp v1.2.3。您需要将您的Akka依赖项降级回1.2.3 (此时Akka.FSharp在V1.3中还不可用)。
https://stackoverflow.com/questions/45906694
复制相似问题