c# - 使用 NancyWcfGenericService 运行 Nancy + Mono 时出错

标签 c# mono nancy

我尝试在带有 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 上运行。

最佳答案

WCF 并没有真正在 Mono 上实现或支持,说实话,我很惊讶它能走到这一步。

如果您想在 Mono 上自行托管,请使用 Nancy.Hosting.Self 或 Nancy.Owin 以及 OWIN 自托管(例如 Katana 或 nowin)。

关于c# - 使用 NancyWcfGenericService 运行 Nancy + Mono 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23807678/

相关文章:

c# - Nancy:在 AfterRequest 事件中修改模型?

c# - 如何在 nancy 模块端保留成员变量或属性?

javascript - Nancy + .NET Core 启用 CORS 不起作用

c# - ASP.NET 使用 Twitter 按钮登录 - 如果已经通过身份验证,如何停止要求用户进行身份验证?

c# - 如何使用来自 nuget 的包在 Mono 中构建 C# 程序?

c# - 单声道 ASP.NET 异常

c# - 检查字节数组是否为零的 SSE 指令 C#

c# - 静态集合和asp.net

c# - 如何以编程方式登录到窗口 7,8 桌面

c# - Visual Studio $(ProjectDir) 是空字符串