TFS 2010将SOAP警报发送到WCF 4.0服务时出现404错误

时间:2010-11-07 07:30:42

标签: wcf soap tfs

我正在尝试编写一个WCF 4.0服务,该服务将从TFS 2010接收SOAP警报。这是我的服务合同:

 [ServiceContract(Namespace = "http://schemas.microsoft.com/TeamFoundation/2005/06/Services/Notification/03")]
 public interface IService1
 {
        [OperationContract(Action = "http://schemas.microsoft.com/TeamFoundation/2005/06/Services/Notification/03/Notify")]
        [XmlSerializerFormat(Style = OperationFormatStyle.Document)]
        void Notify(string eventXml, string tfsIdentityXml);
 }

我正在为我的服务端点使用此绑定配置:

 <bindings>
  <wsHttpBinding>
   <binding name="noSecurity">
    <security mode="None"/>
   </binding>
  </wsHttpBinding >
 </bindings> 

使用BISSUBSCRIBE.EXE注册了TFS警报并将其指向我的服务,每次触发时我的服务都没有被调用,而是在TfsJobAgent日志中看到以下内容:

 Notification not delivered.
 Notification: WorkItemChangedEvent (DeliveryType: Soap; Address: http://192.168.10.10/TrafficLight/Service1.svc)
 Exception: Microsoft.TeamFoundation.TeamFoundationServiceUnavailableException: Team Foundation services are not available from server http://192.168.10.10/TrafficLight/Service1.svc.  Technical information (for administrator):
 HTTP code 404: Not Found ---> System.Net.WebException: The remote server returned an error: (404) Not Found.
  at System.Net.HttpWebRequest.GetResponse()
  at Microsoft.TeamFoundation.Client.TeamFoundationClientProxyBase.AsyncWebRequest.ExecRequest(Object obj)
  --- End of inner exception stack trace ---
  at Microsoft.TeamFoundation.Client.TeamFoundationClientProxyBase.ProcessHttpResponse(HttpWebResponse response, Stream responseStream, WebException webException, XmlReader& xmlResponseReader)
  at Microsoft.TeamFoundation.Client.TeamFoundationClientProxyBase.ExecWebServiceRequest(HttpWebRequest request, XmlWriter requestXml, String methodName, HttpWebResponse& response)
  at Microsoft.TeamFoundation.JobService.Extensions.Core.TeamFoundationNotificationClient.Notify(String eventXml, String tfsIdentityXml, Subscription subscription)
  at Microsoft.TeamFoundation.JobService.Extensions.Core.NotificationJobExtension.SendSoapNotification(TeamFoundationRequestContext requestContext, TeamFoundationNotification notification, TeamFoundationIdentityService identityService) 

(这取自我的TFS 2010安装的[Tfs_Configuration]。[dbo]。[tbl_JobHistory]表)

奇怪的是,当我在运行TfsJobAgent的同一台机器上的Internet Explorer中尝试我的服务URL时,我收到标准的“你已经创建了一个服务”。 WCF自动生成的网页, 404错误。

最后,我的问题:为什么TFS作业代理从我的服务收到404错误似乎已正确配置?我该如何解决这个问题?

更新:我尝试将我的服务重写为ASMX Web服务并且运行良好。以下是实施。我仍然想学习如何使用WCF 4.0实现相同的功能,因此我们将非常感谢任何帮助。

 [WebService(Namespace = "http://tempuri.org/")]
 [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
 [System.ComponentModel.ToolboxItem(false)]
 public class WebService1 : System.Web.Services.WebService
 {
  [SoapDocumentMethod("http://schemas.microsoft.com/TeamFoundation/2005/06/Services/Notification/03/Notify", RequestNamespace = "http://schemas.microsoft.com/TeamFoundation/2005/06/Services/Notification/03")]
  [WebMethod]
  public void Notify(string eventXml, string tfsIdentityXml)
  {
   // log incoming event...
  }

1 个答案:

答案 0 :(得分:2)

我已成功创建了这个 - http://www.ewaldhofman.nl/post/2010/08/02/How-to-use-WCF-to-subscribe-to-the-TFS-2010-Event-Service-rolling-up-hours.aspx - 而且您似乎正在使用相同的步骤。

您是否还为端点指定了wsHttpBinding?