Search
Tuesday, January 21, 2020 ..:: Blendblog.net ::.. Register  Login
 Bloggers Minimize

  
 Sponsors Minimize

 Print   
 Users Online Minimize
Membership Membership:
Latest New User Latest: JanaSimpson
New Today New Today: 0
New Yesterday New Yesterday: 0
User Count Overall: 8289

People Online People Online:
Visitors Visitors: 6
Members Members: 0
Total Total: 6

Online Now Online Now:

  
 Welcome to blendblog.net! Minimize

If you are a developer or designer who is creating cutting edge user interface experiences using Microsoft Expression Blend you've just found a great resource!  The purpose of this site is to share our experience with this brand new product.  As with any new piece of software there is a ton to discover.  Bugs will be revealed and workarounds discovered, hopefully this can be a resource to share in the discovery process!

While this site will focus largely on Expression Blend, it will also encompass WPF, Visual Studio, Silverlight, and other .net 3.5 technologies as they relate to the creation of great software.

Please login using your Microsoft LiveID or register a new account.  Doing so will let you comment on any of the blog entries on the site.  We look forward to helping you in your endeavors as well as you helping others in theirs!  We'd love to have more bloggers on our site...if you are interested please register and contact us!

Follow us:


  
 Visual Studio 2010 TFS WorkItemEventChanged Alerts and WCF with sample web project Minimize
Location: BlogsSean Cullinan    
Posted by: Sean Cullinan 6/18/2010 3:26 PM

 

We are finally in the process of implementing Visual Studio TFS where I work.  In our process exploration we decided we would need to write a webservice that TFS could notify whenever a workitem or other change happened. 

TFS lets you setup alerts, in 2010 you can simply do this by going to the Team->Alerts Explorer window.  You are greeted with an interface that lets you setup an alert type, conditions for the alert, and how you want the alert to happen.  You can alert people via Plain Text or HTML email OR you can also alert a webservice/wcf via SOAP.  Basically when the conditional is met it makes a SOAP call to a webservice you setup.

There were no real "starter projects" that I could find that were for building it using WCF in VIsual Studio 2010/.net framework 4.0.  Everything on the web was a bit outdated.  Needless to say when I created the service and setup the alert to call it nothing happened.  The first step was figuring out why the failure happened and to do this you need to setup the TFS server to log what happens when it tries to make the alert.  This is done by editing the TFSJobAgent.exe.config file located on the TFS application server in the C:\Program Files\Microsoft Team Foundation Server 2010\Application Tier\TFSJobAgent folder.  You need to edit the system.diagnostics section, here's how mine looks:

<system.diagnostics>
    <trace autoflush="false" indentsize="4">
      <!--To enable tracing to file, simply uncomment listeners section and set trace switch(es) below.
          Directory specified for TextWriterTraceListener output must exist, and job agent service account must have write permissions. -->
      <listeners>
        <add name="myListener"
          type="System.Diagnostics.TextWriterTraceListener"
          initializeData="C:\windows\temp\jobagent.log" />
        <remove name="Default" />
      </listeners>
    </trace>
    <switches>
      <!--  Trace Switches
            Each of the trace switches should be set to a value between 0 and 4, inclusive.
              0: No trace output
              1-4: Increasing levels of trace output; see Systems.Diagnostics.TraceLevel-->
      <add name="API" value="0" />
      <add name="Authentication" value="0" />
      <add name="Authorization" value="0" />
      <add name="Database" value="0" />
      <add name="General" value="3" />
      <add name="traceLevel" value="1" />
    </switches>
   </system.diagnostics>

This logs things, including the status of alert failures to c:\windows\temp\jobagent.log (you can change this of course).  Once you do this you need to restart the Visual Studio Team Foundation Background Job Agent" service.

Checking the logs I saw that the following error message ocurring (just posting relevant section):  HTTP code 415: Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'

After much googling I discovered that this is because TFS 2010 is using SOAP 1.2 and needs wsHttpBinding setup on the service application.  Unfortunately this took me forever to figuer out how to get it working.  I had to modify my services web.config but kept getting errors because I wasn't specifying the full name <namespace.interface/class> in my web.config.  With no starter/sample project to work with I was flying pretty blind and the error messages were not very intuitive.  After much trial and error I figured out the proper web.config settings and all was working!

Attached is a great sample/starter project for creating your TFS2010 notification WCF services in Visual Studio 2010/.net 4.0.  My sample is posted in VB but it is easy to convert to C#.  Hopefully this helps others avoid the confusion, frustrations and problems I had.  It would be nice if MS would've shipped a starter template for creating this but they did not.

Also note that notifications by default are processed in batch every 2 minutes in TFS 2010.  You can set this to a shorter value by following this article (just paste the commands into powershell): http://blogs.msdn.com/b/chrisid/archive/2010/03/05/faster-delivery-of-notifications.aspx.

(Updated 6/18/2010) I just updated the sample project.  It now contains code to nicely parse out the eventXML into an object!  I used Linq for the XML parsing.  This is now a great starter project that you can use not only to get your service running but also get a defined "ChangedWorkItem" object to work with.

Sean

WorkItemEventHandler.zip

Permalink |  Trackback

Comments (1)   Add Comment
http://www.ukfitflops.com/    By fitflop shoes on 3/5/2014 9:59 PM
<p>We announced our run <a href="http://www.coach-factory-outlet-online.com/" title="coach factory">coach factory outlet online</a> and by Tuesday morning, we had emails from running crews around the world who wanted to take this <a href="http://www.michaelkorsoutletmkstore.com/" title="michael kors outlet">michael kors outlet</a> global, to which we said HELL YEAH! The <a href="http://www.coachfactoryoutlets2014.com/" title="coach factory">coach factory outlet</a> hue is much more fun, and it's made from a tougher <a href="http://www.coachfactoryoutletspurse.com/" title="coach factory outlet">coach outlet</a>.Models wear creations for <a href="http://www.michael-kors-outlet-store.com/" title="michael kors outlet">michael kors outlet</a>'s ready-to-wear autumn/winter collection. Since then, <a href="http://www.coachstoreonline.com/" title="coach outlet store online">coach outlet store online</a> got his physical act back together with some winter training in his <a href="http://www.coachoutletstoreonline2014.com/" title="coach outlet store online">coach outlet store online</a> as well as a trip to <a href="http://www.fitflopdesign.com/" title="fitflops">fitflop</a> summer in Patagonia.The 36-year old "<a href="http://www.coachhandbagsnew2014.com/" title="coach handbags">coach handbags outlet</a> Lines" singer returned to the stage last night for his first concert following the news of he and <a href="http://www.coachfactoryoutlethandbags.com/" title="coach factory handbags outlet">coach factory outlet</a>'s separation, and he opened up to the audience before dedicating his song "<a href="http://www.ukfitflops.com/" title="fitflop">fitflop shoes</a>" to his estranged wife. </p><br><p>It has to fall somewhere between <a href="http://www.pradaoutlet-store.com/" title="prada outlet">prada outlet</a> and sensible (granted, that's a word rarely uttered along the front rows of any runway). What's your secret to traveling in style?Here are some <a href="http://www.fitflopflip-flop.com/" title="flip flops">fitflop shoes</a> paper dolls to help you create your own <a href="http://www.coachfactoryoutlets2014.com/" title="www.coachfactory.com/store">www.coachfactory.com/store</a>. How (ahem) scandalous.We have seen <a href="http://www.fitflopsflipflops.com/" title="flip flops">fitflops</a> for several charities. Clarks Sportswear Tawyer silhouette by fitflops, we're given a couple new angles on the shoe, which is dressed up in navy and burgundy, with leather laces and a rubber;</p><br>


Your name:
Title:
Comment:
Add Comment   Cancel 

  
 Search Minimize

  
 Archive Minimize

  
 Blendblog Survey Minimize
Our next client application will be written using:




Which Tablet Do you expect to buy?





Submit Survey  View Results

 Print   
Copyright 2011 by blendblog.net   Terms Of Use  Privacy Statement
DotNetNuke® is copyright 2002-2020 by DotNetNuke Corporation