简体   繁体   中英

Sending parameters as path segments doesn't work in ServiceStack

I'm trying to make a GET request to my SS service but the parameters have empty values when I send them as URL segments. According to https://github.com/ServiceStack/ServiceStack/wiki/Routing I can call the service in two ways:

/resource/p1/p2/p3 or /resource?p1=v1&p2=v2&p3=v3

The first method never works (the parameters have default values depending on their types) and the second one always works. I wan't to call the service using the first method.

Here's my code

//Request DTO    
[Route("/test/{Param1}/{Param2}/{Param3}")]
public class Test
{
    public string Param1 { get; set; }
    public int Param2 { get; set; }
    public string Param3 { get; set; }
}

//Response DTO    
public class TestResponse : IHasResponseStatus
{
    public ResponseStatus ResponseStatus { get; set; }
    public string Inputs { get; set; }
}

What am I doing wrong?

只是为了解决问题:esker发布了一个链接,其中mythz确认我们所遇到的实际上是IIS / ASP.NET错误。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM