mardi 4 mai 2010

My WCF application is not called by TFS 2010 Event Service

For TFS 2010 be able to contact your WCF you have to use the WSHttpBinding and you have to specify a bindingConfiguration that disable the security. You can see below what I use for mine.

I hope that will help someone (at least Nicolas M).


ITfsEventSubscriber.cs :


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



TfsEventSubscriber.cs :

...
public class TfsEventSubscriber : ITfsEventSubscriber
{
    void ITfsEventSubscriber.Notify(String eventXml, String tfsIdentityXml)
    {
        // My notify code
    }
}
...



Web.config :


...
<system.serviceModel>
    <bindings>
     <wsHttpBinding>
        <binding name="NoSecurity">
         <security mode="None">
         </security>
        </binding>
     </wsHttpBinding>
    </bindings>
    
    <services>
     <service behaviorConfiguration="WcfTfsDeployer.Behavior" name="WcfTfsDeployer.TfsEventSubscriber">
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <endpoint address="" binding="wsHttpBinding" bindingConfiguration="NoSecurity" contract="WcfTfsDeployer.ITfsEventSubscriber" />
     </service>
    
    </services>

    <behaviors>
     <serviceBehaviors>
        <behavior name="WcfTfsDeployer.Behavior">
         <serviceMetadata httpGetEnabled="true"/>
         <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
     </serviceBehaviors>
    </behaviors>
</system.serviceModel>



...

Aucun commentaire: