【问题标题】:Error running Nancy + Mono using NancyWcfGenericService使用 NancyWcfGenericService 运行 Nancy + Mono 时出错
【发布时间】:2014-05-22 13:04:31
【问题描述】:

我正在尝试在具有 mono 3.2.8 的 ubuntu 服务器上运行 Nancy,当我启动服务器时它给了我以下错误:

:~/temp$ sudo mono Medusa.WEB.Server.exe
System.InvalidOperationException: ContractDescription 'NancyWcfGenericService' has zero operations; a contract must have at least one operation.
  at System.ServiceModel.Description.ServiceEndpoint.Validate () [0x00000] in <filename unknown>:0
  at System.ServiceModel.ServiceHostBase.ValidateDescription () [0x00000] in <filename unknown>:0
  at System.ServiceModel.ServiceHostBase.InitializeRuntime () [0x00000] in <filename unknown>:0
  at System.ServiceModel.ServiceHostBase.OnOpen (TimeSpan timeout) [0x00000] in <filename unknown>:0
  at System.ServiceModel.Channels.CommunicationObject.Open (TimeSpan timeout) [0x00000] in <filename unknown>:0
  at System.ServiceModel.Channels.CommunicationObject.Open () [0x00000] in <filename unknown>:0
  at Medusa.WEB.Server.WcfWebServer.Start () [0x00000] in <filename unknown>:0

当我尝试使用 mono 2.10 时没有发生此错误,而是在我调用其余 web 服务时遇到了不同的错误(这就是我更新到 3.2.8 的原因)。此外,服务器可以在 Windows 上运行。

【问题讨论】:

    标签: c# mono nancy


    【解决方案1】:

    WCF 并没有真正在 Mono 上实现或支持,老实说,我很惊讶它能走这么远。

    如果您想在 Mono 上自托管,请使用 Nancy.Hosting.Self 或 Nancy.Owin 以及像 Katana 或 nowin 这样的 OWIN 自托管。

    【讨论】:

    • 是的,我让它与 Nancy.Hosting.Self 一起运行,但现在我在尝试调用本机库时遇到问题(这是一个 SO,但我将其重命名为 .dll,所以我没有必须更改代码)。但是单声道不能处理 WCF 是一种耻辱
    • 您应该将 DLL 映射添加到配置文件中,而不是重命名文件:mono-project.com/Config_DllMap
    猜你喜欢
    • 1970-01-01
    • 2016-10-11
    • 2012-11-12
    • 1970-01-01
    • 1970-01-01
    • 2014-05-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多