【发布时间】:2018-03-12 10:43:18
【问题描述】:
我对 C# 很陌生,需要实现 REST 服务,所以我偶然发现了 Grapevine。 我需要通过配置文件在服务启动时移交服务的部分 URL,但我没有设法将配置文件的值“clientId”移交给 Route 的 Pathinfo,因为它不是恒定的。 以下是部分代码:
[RestResource(BasePath = "/RestService/")]
public class Rest_Resource
{
public string clientId = ConfigurationManager.AppSettings["ClientId"];
[RestRoute(PathInfo = clientId + "/info")]//<-how do I fill Pathinfo with dynamic values?
public IHttpContext GetVersion(IHttpContext context)
{....}
}
我在visual studio中使用gravevine v4.1.1作为nuget包。
【问题讨论】: