在 VS 2013 中添加对 Servicestack simpleservice 的引用失败

Add reference to a Servicestack simpleservice in VS 2013 fails

我有一个有趣的问题。如果我的 servicestack 方法上有一个 return 对象并且想要使用 SOAP,VS2013 可以生成一个带有添加服务引用的代理。但是如果我在方法上有一个 return 类型的字符串,它会失败并显示 "Custom tool warning: Cannot import wsdl:portType" 和另外 3 个错误。

这些方法之间的唯一区别是:

    [TerminalAuth]
    public CloseOrderResponse Any(CloseOrder dto)
    {

        var resp = new CloseOrderResponse() {Data = "bla"};
        return resp;

    }
    [TerminalAuth]
    public string Any(CloseOrder2 dto)
    {
        return "bla";
    }

如果我 comment/hide 第二种方法它生成 reference.cs 就好了,但是第二个(或仅第二个)它失败了。结果是reference.cs只有评论头,没有代码

有什么想法吗?

/埃里克

请务必阅读 ServiceStack SOAP Limitations:

SOAP expects that each request always returns the same response DTO. So you need to follow the response DTO naming convention, otherwise ServiceStack won't be able to generate the WSDLs and the SOAP endpoint won't work.

DTO 命名约定

命名约定:{Request DTO Name} + 响应

示例:请求 DTO:DeleteCustomer -> 响应 DTO:DeleteCustomerResponse

您可以使用 [Exclude] 属性隐藏在 WSDL 中生成的不兼容类型,例如:

[Exclude(Feature.Soap)]
public class CloseOrder2 
{
}