代码之家  ›  专栏  ›  技术社区  ›  devowiec

ServiceStack AppHost()。Init()引发ArgumentException

  •  1
  • devowiec  · 技术社区  · 7 年前

    我的问题是 AppHost().Init() 投掷 System.ArgumentException Expression of type 'System.Int32' cannot be used for return type 'System.Object' . 堆栈跟踪显示

       at System.Linq.Expressions.Expression.ValidateLambdaArgs(Type delegateType, Expression& body, ReadOnlyCollection`1 parameters)
    

    关于代码的一些细节:我当前的ServiceStack版本是4.0.52。我从未重新安装或升级ServiceStack。我已经要求DTO返回 int 在申请中,他们几天前表现很好。我不知道我之前做了什么导致了这个错误。

    1 回复  |  直到 7 年前
        1
  •  2
  •   mythz    7 年前

    ServiceStack服务的返回类型需要是引用类型,理想情况下是响应DTO,但也可以是原始数据类型,如 string byte[] .