2010-11-07 47 views
1

我想寫一個WCF 4.0服務將接收SOAP提醒,從2010年在這裏TFS 404錯誤是我的服務合同:當TFS 2010發送SOAP警報到WCF 4.0服務

[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_Configuration]拍攝。[DBO]。[tbl_JobHistory]我的TFS 2010安裝的表)

奇怪的是,當我嘗試在同一臺機器,其中在Internet Explorer我服務的URL TfsJobAgent正在運行,我收到標準的「您已經創建了一項服務」。由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... 
    } 

回答

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?

+0

嗨埃瓦爾德。非常感謝這篇教程 - 我依靠它來獲取我的位置。關於wsHttpBinding - 我已經嘗試了這兩個和basicHttpBinding無濟於事:| – urig 2010-11-08 07:53:06

+0

我已經在你的教程再次Ewald,嘗試wsHttpBinding與安全模式設置爲無,現在它的工作。謝謝! – urig 2010-11-08 08:01:06