TFS 2010 向 WCF 4.0 服务发送 SOAP 警报时出现 404 错误 [英] 404 Error when TFS 2010 Sends SOAP Alert to a WCF 4.0 Service

查看:24
本文介绍了TFS 2010 向 WCF 4.0 服务发送 SOAP 警报时出现 404 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to write a WCF 4.0 service that will receive SOAP alerts from TFS 2010. Here is my service contract:

 [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);
 }

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

I am using this binding configuration for my service endpoint:

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

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

Having registered a TFS alert using BISSUBSCRIBE.EXE and pointed it to my service, every time it is triggered my service is not invoked and instead I see the following in the TfsJobAgent log:

 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] ​​表)

(This is taken from the [Tfs_Configuration].[dbo].[tbl_JobHistory] table of my TFS 2010 installation)

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

Oddly enough, when I try my service's URL in internet explorer on the same machine where the TfsJobAgent is running, I receive the standard "You have created a service." web page auto-generated by WCF and not a 404 error.

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

更新:我尝试将我的服务重写为 ASMX Web 服务,并且运行良好.下面是实现.我仍然想学习如何使用 WCF 4.0 实现相同的目标,因此我们将不胜感激.

Update: I've tried rewriting my service as an ASMX web service and it's working well. Below is the implementation. I still want to learn how to achieve the same using WCF 4.0 so any help would be greatly appreciated.

 [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...
  }

推荐答案

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

I have created this succesfully - http://www.ewaldhofman.nl/post/2010/08/02/How-to-use-WCF-to-subscribe-to-the-TFS-2010-Event-Service-rolling-up-hours.aspx - and it seems that you are using the same steps.

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

Did you also specify the wsHttpBinding for the endpoint?

这篇关于TFS 2010 向 WCF 4.0 服务发送 SOAP 警报时出现 404 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆