我正在尝试将 TFS 2012 事件通知连接到 ServiceStack,但我不断收到错误消息:
{
"responseStatus": {
"errorCode": "RequestBindingException",
"message": "Unable to bind request",
"stackTrace": "at ServiceStack.WebHost.Endpoints.RestHandler.GetRequest(IHttpRequest httpReq, IRestPath restPath)\r\n
at ServiceStack.WebHost.Endpoints.RestHandler.ProcessRequest (IHttpRequest httpReq, IHttpResponse httpRes, String operationName)"
}
}
这是我的 DTO(它包含一些我试图让它工作的位)。
[Route("/releasemanagement/tfsevents/buildcomplete", "POST")]
[DataContract(Namespace = "http://www.w3.org/2001/XMLSchema-instance")]
public class TfsEventBuildComplete : IReturn<BuildCompleteResponse>
{
[DataMember]
public string BuildUri { get; set; }
[DataMember]
public string TeamFoundationServerUrl { get; set; }
[DataMember]
public string TeamProject { get; set; }
[DataMember]
public string Title { get; set; }
[DataMember]
public string Id { get; set; }
[DataMember]
public TfsEventStatusChange StatusChange { get; set; }
[DataMember]
public string ChangedBy { get; set; }
}
public class TfsEventStatusChange
{
public string FieldName { get; set; }
public string NewValue { get; set; }
}
以下是来自 TFS 的 XML:
<BuildStatusChangeEvent xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<BuildUri>vstfs:///Build/Build/4799</BuildUri>
<TeamFoundationServerUrl>http://TFSURL:8080/tfs/collection</TeamFoundationServerUrl>
<TeamProject>iSAMS</TeamProject>
<Title>iSAMS Build Release_20130814.1 Quality Changed To Publish</Title>
<Subscriber>[02]\Project Collection Service Accounts</Subscriber>
<Id>Release_20130814.1</Id>
<Url>http://TFSURL:8080/tfs/web/build.aspx?pcguid=GUID&builduri=vstfs:///Build/Build/4799</Url>
<TimeZone>GMT Daylight Time</TimeZone>
<TimeZoneOffset>+01:00:00</TimeZoneOffset>
<ChangedTime>8/14/2013 9:33:30 AM</ChangedTime>
<StatusChange>
<FieldName>Quality</FieldName>
<NewValue>Publish</NewValue>
</StatusChange>
<ChangedBy>DOMAIN\USER</ChangedBy>
</BuildStatusChangeEvent>
我认为由于命名空间,ServiceStack 实际上无法反序列化请求,但我无法弄清楚。
我尝试过的大部分内容都来自这里: