首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >ServiceStack: Routes.AddFromAssembly仍然使用/json/回复路径,并且属性没有URL-niceness

ServiceStack: Routes.AddFromAssembly仍然使用/json/回复路径,并且属性没有URL-niceness
EN

Stack Overflow用户
提问于 2018-09-15 12:56:29
回答 1查看 43关注 0票数 1

我有一个使用AppSelfHostBase的ServiceStack自托管the服务。

WHen方法被执行,我有这样的配置:

代码语言:javascript
复制
public override void Configure(Container container)
{
    Config.RouteNamingConventions = new List<RouteNamingConventionDelegate> {
        RouteNamingConvention.WithRequestDtoName,
        RouteNamingConvention.WithMatchingAttributes,     
        RouteNamingConvention.WithMatchingPropertyNames,  
    };

    Routes.AddFromAssembly(typeof(ServiceStackHost).Assembly);

我希望下面的服务在/StartBankIdAuthentication路径下执行,但它却驻留在/json/reply/StartBankIdAuthentication下。

代码语言:javascript
复制
public class StartBankIdAuthentication : IReturn<StartBankIdAuthenticationResponse>
{
    public string IdNbr { get; set; }
}

另外,有没有一种自动的方法使DTO中的属性位于“子路径”下,如/StartBankIdAuthentication/1234而不是/StartBankIdAuthentication?IdNbr=1234

我知道我可以手动添加Route属性,但它看起来很麻烦,而且在许多方面也很混乱(不键入,容易出错等)。

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52341689

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档