我有几个使用 ServiceStack 定义的服务,它们工作正常。我使用以下请求对象添加了一个新对象
namespace LCS.Presentation.API.Model.DocumentTemplates
{
[Authenticate]
[Route("/document/{Type}/{Id}", "GET,PUT")]
[Route("/document/{Type}", "POST")]
public class UploadFileRequest : IReturn<UploadFileResponse>
{
public long Id { get; set; }
public string Type { get; set; }
public string Filename { get; set; }
public string File { get; set; }
}
}
我定义了一个响应对象:
public class UploadFileResponse : IResponseBase
{
public string Path { get; set; }
public ResponseStatus ResponseStatus { get; set; }
}
和服务的书面存根:
public class UploadFileService : Service
{
private ICoreLoggingService Logger { get; set; }
public UploadFileService(ICoreLoggingService logger)
{
Logger = logger;
}
public UploadFileResponse Post(UploadFileRequest request)
{
Logger.Debug("Got POST file request: {0}", request);
var response = new UploadFileResponse();
return response;
}
public UploadFileResponse Put(UploadFileRequest request)
{
Logger.Debug("Got PUT file request: {0}", request);
var response = new UploadFileResponse();
return response;
}
public UploadFileResponse Get(UploadFileRequest request)
{
return null;
}
}
但是,当我转到元数据页面 (/api/metadata) 时,我没有看到 UploadFileRequest 服务与我的其他服务一起列出。
ServiceStack 配置为植根于 /api,并且我的所有其他服务正确显示在元数据页面中,因为配置为使用该路由。
我错过了什么导致 ServiceStack 不将其视为可用服务?