Blog Archives

Enabling Self-Service On-Demand Provisioning of Dev Environments

Check out other posts in this multi-author series by going here.

Development environments are a primary use case for using Azure today. As with production scenarios, the elastic nature of the cloud allows organizations to spin up computing power based on usage. If you only need a dev/test environment for a few minutes, then that’s all Azure will bill you for. In my experience though, Operations has been primarily focused on production – as they should be! Unfortunately, this means it can be challenging to find the resources needed to provision AND maintain development environments. On top of this, developers are being asked to dramatically increase their release cycles, so they may need to spin up and down numerous environments with very little advance notice to order hardware and then allocate time to provision and configure.

Enter Self-Service!! Azure gives your team the ability to stand up their own development and test environments. There are numerous ways to provision environments using Azure. In this post, I’ll detail the following options:

  • Visual Studio Platform Images for MSDN Subscribers
  • Visual Studio + Azure SDK
  • Azure Management Portal
  • Windows Azure Pack

Visual Studio Platform Images for MSDN Subscribers

In some cases, the only development environment you need is a machine running Visual Studio. Azure provides a gallery of virtual machine images with preinstalled software and it includes images with Visual Studio ready to go! (At the time I wrote this, these images were not available in the Azure preview portal [“Ibiza”] and were only available in the full Azure portal.)

Each Visual Studio image is tied to an MSDN subscription level. For example, as an Ultimate subscriber, I can provision a virtual machine preloaded with Visual Studio Ultimate since I own that license. (Selecting a version of Visual Studio that I am not licensed for can put my organization at risk of non-compliance!)

If you are a developer with Visual Studio Premium or Ultimate, then you are already Premium/Ultimate MSDN subscriber. If you are a QA person running Microsoft Test Manager, you are also an MSDN Premium subscriber.

Step 1: In Internet Explorer, navigate to the Microsoft Azure Management Portal (http://manage.windowsazure.com), click NEW in the bottom-left corner, select VIRTUAL MACHINE, and select FROM GALLERY.

Step 2: In the CREATE A VIRTUAL MACHINE wizard, select VISUAL STUDIO from the filter list, select the desired, and click the Next arrow. Be sure to select the image that corresponds to your MSDN Subscription level and the desired OS.

Step 3: On page 2, enter a unique name for your machine, select a tier/size, provide an administrator username/password, and click the Next arrow.

Step 4: On page 3, you can specify additional information about your virtual machine (DNS, subscription, region, endpoints, etc.). Click the Next arrow when you are finished.

Step 5: On the final page, be sure to leave the Install the VM Agent checkbox checked. This agent allows us to remotely interact with the virtual machine. Click the Finish checkmark to start the provisioning process.

And, that’s it! Alternatively, you could provision one of these images using PowerShell. You now have a virtual machine with the following software pre-installed:

Windows Server 2012

Windows 7

Windows 8.1

Visual Studio Professional, Premium, or Ultimate with Update 2

Yes

Yes

Yes

Windows Azure SDK for .NET 2.3

Yes

Yes

Yes

SQL Server 2012 SP1 Developer Edition

Yes

No

No

SharePoint 2013 Trial

Yes

No

No

Scripts to provision SharePoint 2013 and SQL Server

Yes

No

No

Develop for Windows Store apps

No

No

Yes

Develop for Windows Phone apps (coming later)

No

No

No

 

USE CASE: I work on several, very different types of projects concurrently.

Most developers have just one development machine, but most developers are also working on several different projects at the same time. If your projects differ dramatically, then you can stand up any number of Visual Studio environments in Azure. Each of these environments can be configured for the specific technologies and configurations you need on a given project without worrying about “dirtying” up your machine for other projects. And because Visual Studio supports roaming settings, you can opt to sync your IDE preferences across these machines. Visual Studio and MSDN are licensed per user, so you only pay for the Azure usage.

USE CASE: I’m a SharePoint developer.

In some ways, developing for SharePoint is much more challenging than developing traditional LOB applications. You either directly develop on Windows Server running on you host machine, develop locally and deploy/debug to a remote Windows Server, or develop on Windows Server running on a virtual machine. That last option is quite common, but it means your local machine needs an extravagant amount of resources on your local machine. With the pre-installed software and provided scripts on the Windows Server images, you can simply run some pre-installed PowerShell scripts to quickly stand up an environment ideal for SharePoint development. Included scripts let you set up SharePoint with or without Active Directory, setup a virtual network, provision a virtual machine for Active Directory, and joining to a domain.

USE CASE: My machine isn’t always up-to-date.

In some organizations, it can be very challenging to keep developers up-to-date with both hardware and software. Development teams within an organization often make up a small percentage of the employee base, so it’s challenging to dedicate some portion of your desktop support staff to just this group’s specialized needs.

  • Fast hardware: The tools, utilities, etc. often eat through resources like no other single machine in your organization, so Azure lets them scale the compute power for the needs at hand.
  • Latest VS and other software: Many organizations keep a list of evaluated and approved software that can be installed on employee machines. Unfortunately, developers and IT Pro’s are often called on to work with unapproved or alpha/beta versions of tools, utilities, and libraries. It can be especially disappointing to be “stuck” on older versions of Visual Studio while trying to develop “tomorrow’s” applications for the organization. While it doesn’t eliminate the need to be a responsible employee, by moving your development environment to Azure, these power users can use these as yet unapproved tools in a relatively safe way.
  • Admin access: Closely related to the last point, the somewhat isolated and potentially temporary nature of these cloud development environments means these users will have complete administrative access to these machines to install and configure the software as needed – a requirement to develop a lot of today’s modern applications.

Visual Studio + Azure SDK

One of the things we’ve been doing with the Visual Studio Azure Tools is to make the experience of working with cloud resources as seamless as working with your own local resources. Starting really with Azure SDK 2.2, we allowed to provision, debug, and shut down Azure resources without leaving Visual Studio.

Step 1: In Visual Studio, create a new web project and click the OK button. (This only works for those projects based on ASP.NET Web Applications, so it won’t work for applications like WCF.)

Step 2: The New ASP.NET Project dialog appears. In the bottom-right corner check the box labeled Host in the cloud and select either Web Site or Virtual Machine from the dropdown list. (I’ve always been confused why this page is needed. It seem like this stuff could be in the project’s Properties page.)


Step 3: If you elected to create a VM, the Create virtual machine on Windows Azure dialog appears. Provide the desired details like DNS name, VM image and size, and credentials. Click the OK button when you are ready.

After you click OK, you can immediately start writing code. The virtual machine provisioning will start in the background and Azure will do most of the work. The Visual Studio Output window will appear so you can follow along with what’s happening.

USE CASE: I develop ASP.NET web applications.

As you can see, if you are an ASP.NET web developer, we make it trivial to spin up an Azure Web Site or Virtual Machine to use as your development environment. You’ll still need to publish your app, but you’ll see we’ve already created the publish profile for your application.

If you are signed into Azure, the resource will appear in your Server Explorer under the appropriate Azure node. Amongst other actions, you can right-click it and select Enable Debugging. This enables remote debugging so you can run the web application in Azure and have it break into your local Visual Studio instance to see how it behaves.

USE CASE: I don’t use Visual Studio, but I provision environments for applications.

If you aren’t a Visual Studio user, then provisioning your application environment from the IDE won’t really help you. Well, you’re in luck! When a developer creates a new Visual Studio web project and opts to provision an environment, we actually do this by generating and running a PowerShell script. That PS script file, along with a JSON configuration file are saved with the Visual Studio project. The project creator can make these files available to you so you can modify as you choose and run them yourself. It’s common for developers to initially provision an environment using their own MSDN subscription to take advantage of their monthly credits, but soon after, it makes sense to spin these environments up for use by others. While the developer could do this, they may not be owners of the organization’s Azure account.

Azure Management Portal

Unlike the previous options, you are likely already familiar with the Azure Management Portal – the web application that gives you access to create, configure, and shut down all of our Azure services. But, did you know you can do much of the same thing with PowerShell and there’s even a REST API for developers?

While the current version of the portal is very focused on IT Pro’s, we are hard at work on a newer version of the Azure portal that is committed to offering a better DevOps experience. It’s our belief that a successful DevOps collaboration starts by providing more transparency between the developers and operations sides of the house. Among other things, this new portal will make it easy for operations to send identified issues with actionable feedback to developers in Team Foundation Server and let them track these issues as they move through the development team.

USE CASE: I’m not a developer.

The previous options are pretty obviously geared toward developers, but there are a lot of other people working on the technology solutions that run the modern business: business analysts, QA, product owners, and, of course, operations. People in these roles can use the management portal in their browser to check up on applications, networks, and other services. Whether you care about monitoring applications, managing billing, or configuring the wide variety of Azure services, the management portal is the one-stop shop.

USE CASE: For more fine-grained control or visibility into my Azure resources.

While Visual Studio is hands-down the best developer environment in the world, it does not provide you with all of the capabilities present in the management portal, PowerShell, client libraries and the REST API. Don’t forget about these other tools!

PowerShell can be used to automate common or complex tasks of all kinds, but Azure provides a specific set of PowerShell commandlets that can help you do things like the following:

Check out the Azure Script Center for more samples.

Sometimes, you need to integrate Azure management capabilities with your own applications. This is a brief description of many of what is provided by Azure’s web services.

Service Management Programmatically manage virtual machines, disks, SQL Azure, and cloud services
Azure Mobile Services Query and alter backend data and authenticate with specific identity providers
Web Sites Management Create and configure web sites; check status and usage
Storage Services Programmatically access storage account, blob, queue, table, and file services
Azure AD Graph Create, update, and delete users, groups, roles, and contacts
ACS Management Engage the Access Control Service for claims-based authentication
Managing BizTalk For BizTalk services, create, update, suspend/resume, or delete; create, delete, and list hybrid connections
Scheduler Create, update, and delete scheduled jobs
Service Bus Send and receive messages to or from the service

 

By the way, if you think of a feature that would really help you, let us know at our feedback site.

Windows Azure Pack

Windows Azure Pack is a collection of the tools we use to provide our cloud-hosted experience, but packaged up for you to provide an analogous experience on top of your on-premises resources.

You can download the Windows Azure Pack for Windows Server here.

USE CASE: I still have to manage some on-premises resources.

Wrap your on-premises resources with Windows Azure Pack to provide the following capabilities:

  • A customizable self-service portal
  • An administrative portal to manage user accounts and quotas
  • A service management API for integration into other systems
  • Virtual machine clouds for Windows and Linux IaaS
  • Web site clouds for scalable web hosting
  • Service bus clouds for reliable messaging

So, what goes where?

You should probably create some guidelines within your organization to define when you should use MSDN, when you should use your organization’s Azure subscription, and when you should use on-premises resources. Most organizations have policies on what kinds of data developers should have access to and how to access on-premises or third-party services for development. These same policies are a great starting point to define your organization’s policies on the use of Azure.

If your organization has already developed some policies on when to use Azure for dev/test, I’d love to hear about them. Every organization has a slightly different take on this, but I think there are probably some good, common practices.

Summary

I’ve tried to show you several options for setting up your development environment. But this is not the end of the road, we have a lot more ideas we’ll be rolling out in the next few months and for years to come. The idea of DevOps is not a new one, but no other company is better able to help you deliver on it than Microsoft!

Now Working With Azure Without Leaving Visual Studio!

First, let me say I love what they have done with the Windows Azure user interface on the web. (You can see it here.) The UI is easy to get around, the animations are helpful, etc. Unfortunately, it’s all in the browser and not in my IDE. This means I have to leave my IDE on occasion to do things like publish my app and confirm the names of sites, services, databases, etc.

But times are a changin’! On April 30th, Microsoft released the Windows Azure SDK 2.0 for .NET. This SDK includes enhancements to Visual Studio that provide integration between the IDE and the Azure management services. In this blog post, I’m going to focus on the publishing to Azure features, but there are other features enabled with this SDK that you can read a little more about on Scott Guthrie’s blog post here.

As I have in the past, I’m going to start by right-clicking my web project and selecting Publish… from the context menu.

Again, as before, the Publish Web dialog appears and we’ll click the Import… button to open the Publish Profile dialog.

I used to download my Azure publish profile from the management portal and keep that file in my Visual Studio project, so I could re-use it if I needed to and share it with my team. I would then import it using this dialog. Here comes the new part! Rather than browsing to the file, I’m going to select the first radio button, labeled Import from a Windows Azure web site, and click the Add Windows Azure subscription hyperlink.

The Import Windows Azure Subscriptions dialog appears. We need to download our subscription details, so click Download subscription file to get the .publishsettings file from the portal. This is the only time you’ll need to return to the Azure portal. This settings file includes all of the information about our Azure subscription – not just a single web site’s publish settings. We’ll then return to the Import Windows Azure Subscriptions dialog and browse out to the location of the file we downloaded. Click the Import button to continue.

Returning to the Import Publish Profile dialog, you should be able to select from your existing Azure web sites from the drop down list. Click OK to return to the Publish Web dialog. The publish settings will auto-populate the Connection tab (which is way better than trying to enter/re-enter all of this stuff yourself). If you’d like, you can click Validate Connection to ensure everything is correct.

The rest of the publish process remains unchanged. After clicking the Publish or Close buttons, you will be prompted to save all of your publish settings and if you choose to do so, they will be added to your Visual Studio project under Properties | PublishProfiles.

Now that I’ve published my application, I should probably check on its status. By opening Server Explorer in Visual Studio, you can now see your Azure subscription services. By expanding the Windows Azure Web Sites node, I can see that my teamsystemcafeservices site is running.

There are several useful options available if you right-click your web site. I can start and stop the web site and stream logs to my output window.

Of course, I can save myself the trip out to the management portal again by selecting View Settings and configure my web site right within the IDE.

There are several other features in the new Azure SDK, so check ’em out!

New SharePoint Features for Developers

I recently completed a tour through Kansas City, Minneapolis, Des Moines, and Omaha to demonstrate the new capabilities for SharePoint developers available in Visual Studio Update 1. (Thanks to all of you that attended – despite this crazy weather!)

A special thanks to Neil Iversen from Avtex for his presentation and demos on the new features in SharePoint 2013. His passion and knowledge on the topic was most evident.

image

Three key features for SharePoint developers were the focus of my session:

Unit testing SharePoint

Sad smileMost SharePoint developers I know don’t write unit tests. It’s just too hard to isolate your custom logic from SharePoint. Without unit tests, developers must spend a lot of time setting up environments, inserting test data, and walking through numerous pages to see if their code is working as intended.

Rolling on the floor laughingVisual Studio 2012 Update 1 adds a SharePoint emulation capability based on the Fakes Framework. You can now write unit tests against your code without even having a live instance of SharePoint! You can even alter the behavior of the SharePoint API to control what the API returns to you.

This feature requires Visual Studio Premium and Update 1.

Performance and load testing SharePoint

Steaming madAny time you are writing code, its always good to keep in mind performance implications. Users get frustrated when applications aren’t responsive. Unfortunately, SharePoint is such a dynamic system, that it could be hard to create usable web performance tests in earlier versions of Visual Studio. With sites, lists, and documents all having unique identifiers that varied across environments, these tests would require a lot of manual revisions to the recorded URL’s. There was also a lot of extra “noise” in the HTTP traffic.

Fingers crossedIt never fails that when users need something in SharePoint, a LOT of them also need it – at the same time. So, load testing is also important in SharePoint. They’ll sometimes make a problem worse by retrying their last action because they aren’t sure its working properly.

Hot smileUpdate 1 adds features to make the recording of web performance tests ignore the noise and identify any SharePoint error pages encountered. The dynamic parameter detection has been extended to extract and pass the unique identifiers for SharePoint objects like site names, list GUIDs, document names, and more.

This feature requires Visual Studio Ultimate and Update 1.

Advanced debugging SharePoint with IntelliTrace

Surprised smileDo you support issues reported by your SharePoint users? Ever wonder what to do with those correlation IDs you see on a SharePoint error page? Its not always easy to reproduce issues within SharePoint.

Red heartThis update makes it very easy to take advantage of IntelliTrace in order to see what lines of your code executed leading up to the reported issue. Even though the error didn’t occur in your development environment, IntelliTrace will log all of the activity so you can play it back in Visual Studio – even if you don’t have the source code on your machine! You can also filter to specific correlation IDs within the IntelliTrace log.

This feature requires Visual Studio Ultimate and Update 1.

You can download the slides for our sessions from my SkyDrive here. Most of my demo’s were based on the hands-on labs here (and get the associated VM here).

Are you a SharePoint developer? Are these new features interesting to you? Let me know what you think.

Achievement Points for Doing My Job?!

Like many of you, I’m an avid gamer and I got into this business because of video games. Modern games allow you to brag about your virtual conquests with achievement points awards. Achievements aren’t just about bragging though. Video game achievements also act as a guide prompting you to try to accomplish specific goals. (My Xbox GamerScore is 76,594 – which I’m told is pretty high – maybe a bit too high for an adult with two kids and a full-time job.) Speaking of jobs, wouldn’t it be cool to have those same bragging rights as a developer?

Back in January of this year, Microsoft released Visual Studio Achievements Beta and it was downloaded by more than 120,000 people. This version is still available for download, but it is only for Visual Studio 2010. When I went to see how many people had downloaded the Visual Studio Achievements for VS 2012, I only saw 8,958 downloads and I wanted to write a blog post to help get the word out as many people may not even know there’s a new version.

You can download the new achievements utility from the hyperlink above or from within Visual Studio by going to Tools | Extensions and Updates… After the extension is installed, you’ll have to take a couple other steps.

To list all of the available achievements, from the Visual Studio menu, go to Tools | Achievements. The following screenshot shows the achievements dialog. There are achievements for Visual Studio features, Azure development, Windows 8, and some off-the-wall items as well (e.g. use the goto statement). The blue-ish icons are achievements that I’ve accomplished, while the gray one is an achievement I’ve yet to earn. A list of achievements can also be found here.

image

Click one of the achievements in the Visual Studio dialog and a browser window will open. From here, you can tweet or otherwise socialize your achievements. Your achievement progress is located on your Channel 9 profile’s page.

image

The complete leaderboard can be found here. It’s just a simple list of the registered users and their achievements progress. (It’s at least entertaining to see what the rest of our industry looks like in their profile pictures – wow!)

There’s a Windows Phone application that displays your achievements. You can download it from the Windows Phone Marketplace here or download the source code from here and sideload it. By the way, the source code solution requires the Silverlight for Windows Phone Toolkit.

The Visual Studio Achievements widget can be placed on any web page. You can get a copy of the script and its various customization options here.

The phone and the widget work by utilizing Channel 9’s achievements web service. Get a complete list of achievements by using http://channel9.msdn.com/achievements/visualstudio?json=true or get a list of a particular user’s achievements with http://channel9.msdn.com/niners/[registeredUsername]/achievements/visualstudio?json=true

And finally, you can submit other ideas for achievements to the Channel 9 Q & A section here.

A couple of my customers not only see this as an employee satisfaction effort, but also see it as a way to enable some peer pressure to get their developers trying new features of the IDE and related technologies.

Are you using the Visual Studio Achievements extension? What other features would you like to see? VS Achievements started as a blog post from the community, so the team is definitely listening.

Getting Started With Team Foundation Service – Part 1

The Microsoft Visual Studio Team Foundation Service Preview is available. It is important to note the name is Team Foundation Service and not Team Foundation Server. The Team Foundation Service is Team Foundation Server hosted by Microsoft in Azure. For now, what you get is all of the source control and work item goodness you’d get with an on-premises Team Foundation Server and it’s accessible from anywhere you get internet access. Additionally, this is a cloud-based service which means someone else is taking care of the tedious stuff I hate (and therefore never do): backups, updates, networking, security, etc. Speaking of updates, because this is a cloud-based application, we should expect to see some new features rolled out here before they are available for your on-premises Team Foundation Server. If you are interested in obtaining your own team project collection in the cloud, go here or find someone who can send you an invite to theirs.

As you get started with Team Foundation Service, your first task will likely be creating a new team project. After this, you can “upload” your source code and start creating work items.

  • Navigate to your Team Foundation Service Welcome Page. You should have received a URL when you signed up for your account.
  • Under GETTING STARTED header, click the Create a team project hyperlink.


  • In the CREATE NEW TEAM PROJECT dialog, enter a brief name in the Project name field. Optionally, enter a longer summary of the team project in the Description field. In the Process template drop-down list, choose a process to utilize on this team project.


  • Click the Create Project button to start the creation process. It may take a minute to complete.

I really like the ease of jumping into a hosted Team Foundation Server. In future posts, I’ll talk about some other advantages of the Team Foundation Service. Have you tried it? What do you think?

A WCF Journey – Creating your first web service

Create a basic WCF service

I recently presented a session on WCF to the St. Louis .NET users group and received some good feedback. (It’s always interesting to speak to a group of people with such a wide range of experience.) I thought I’d try to capture some of the details in a series of blog posts that might supplement that talk and provide more detail. I’m starting off slow for beginners, but you’ll be able to skip ahead to certain topics as I get them out there. Even though I’ve been working with WCF for a while now, I’m drafting this as a journey from start to finish, so each topic builds on the previous one. I hope that is helpful although I’m sure it will not satisfy everyone. 😉

Create host application

Open Visual Studio. (I’m using Visual Studio 2010 Ultimate, but I will try to avoid and / or notify you if I use something specific to this version of the IDE.)

From the Visual Studio menu, go to File -> New -> Project. Under Visual C#‘s WCF sub-category, select the WCF Service Application project template. (See WCF Project Templates for more information on why I chose WCF Service Application.)

In the New Project dialog box, enter GearCatalog.Host in the Name field and just GearCatalog for the Solution Name. Click OK.

Press F5 to build the application and enter debug mode. The “Cassini” web development server will host the service and then the WCF Test Client application will open. Double-click either of the exposed operations and click the Invoke button to execute them. I will revisit the WCF Test Client later, but feel free to enter parameters and invoke away!

If the WCF Test Client doesn’t open, you can open it from the following location: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\WcfTestClient.exe. From the File menu, choose Add Service… and in the Add Service dialog, enter the URL to the service running in the ASP.NET development server and click OK. It should be something like this http://localhost:[port]/Service1.svc. The initial port number is auto-generated so you will have to get it by hovering over the ASP.NET Development Server icon or the Web tab found in the project properties page.

Since the WCF Test Client is such a handy tool, you can make it easier to get to by adding it to the Tools menu in Visual Studio. Go to Tools -> External Tools… and in the External Tools dialog, click the Add button. In the Title textbox, enter WCF Test Client and in the Command textbox, enter C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\WcfTestClient.exe.

You’ve just created a WCF service application ready to be hosted in IIS, but let me run through some of the more useful details. I think it’s best to start with the interface. In Solution
Explorer, double-click the IService1.cs file to open it in a code editor window. The interface is decorated with the ServiceContract attribute which designates the class as a WCF service. Both of the interface’s methods are decorated with the OperationContract attribute. This designates these methods as the means of interacting with the service. Additionally, each of these attributes has optional parameters that can dictate specific behavior of the service or its operations and I’ll come back to those in a future post.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace GearCatalog.Host
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
    [ServiceContract]
    public interface IService1
    {

        [OperationContract]
        string GetData(int value);

        [OperationContract]
        CompositeType GetDataUsingDataContract(CompositeType composite);

        // TODO: Add your service operations here
    }

}

Below the service interface is a class named CompositeType. The class declaration is given the DataContract attribute which says this type is serializable. Each of the properties is marked with the DataMember attribute to tell the serializer these properties will be available in the serialized class as well. If a service operation or type isn’t serializable, it cannot be used to communicate with a consumer of your service.

[DataContract]
public class CompositeType
{
    bool boolValue = true;
    string stringValue = "Hello ";

    [DataMember]
    public bool BoolValue
    {
        get { return boolValue; }
        set { boolValue = value; }
    }

    [DataMember]
    public string StringValue
    {
        get { return stringValue; }
        set { stringValue = value; }
    }
}

Open the Service1.svc.cs file. This class simply implements the IService interface. This is where you’ll put the actual functionality of your service operations.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace GearCatalog.Host
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
    public class Service1 : IService1
    {
        public string GetData(int value)
        {
            return string.Format("You entered: {0}", value);
        }

        public CompositeType GetDataUsingDataContract(CompositeType composite)
        {
            if (composite == null)
            {
                throw new ArgumentNullException("composite");
            }
            if (composite.BoolValue)
            {
                composite.StringValue += "Suffix";
            }
            return composite;
        }
    }
}

Right-click the Service1.svc file and choose View Markup from the context menu. This file defines the service’s host. The Service attribute ties this host to a fully-qualified type name implementing a service. The CodeBehind attribute defines the file wherein the service implementation is defined.

<%@ ServiceHost Language=”C#” Debug=”true” 
Service=”GearCatalog.Host.Service1″ CodeBehind=”Service1.svc.cs” %>

The web.config file in .NET 4 isn’t very big. While a WCF service is truly defined by Address, Binding, and Contract (the ABC’s of WCF), WCF 4 doesn’t require you explicitly define any of these things. You will probably want to, but we’ll come back to that later as well.

As a developer, getting the details of any thrown exceptions is vital. The includeExceptionDetailInFaults attribute of the serviceDebug element (about halfway down) defaults to true and should remain so in development. As the comment states, you should turn this to false before deploying the service to a production environment so you don’t provide consumers with too much info on the inner workings that could be used against you!

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>

In the next post, we’ll start customizing this service. We’ll start by creating our model to represent our business objects.

Is it over yet?

We recently completed our TFS 2010 upgrade process at my place of work. Since it was our second attempt in recent months, we all breathed a sigh of relief when it completed successfully.

Suddenly, I started getting a lot of questions from my co-workers, “How come [new TFS feature X] isn’t working?!”

After upgrading a TFS instance, you will still be using your original Team Projects, some features of TFS 2010 will not be available to these Team Projects. This allows you to ease into the adoption one Team Project and / or feature at a time.

This first post in the series describes the easiest feature to enable.

Branch Visualization

In Source Control Explorer, right-click the folder that represents your root/top level branch. In the context menu that appears, mouse over Branching and Merging and click on the Convert to Branch… option. The folder icon will change to a new icon clearly identifying it as a branch.

Now right-click on one the branch icon and again mouse over Branching and Merging. The convert option is replaced by a View Hierarchy option.

Branching - View Hierarchy

 The Branch Hierarchy diagram appears. From here you can see how branches interrelate. You can even branch, merge or compare selected branches.

One of the coolest features now enabled however is the ability to track a changeset across branches. Right-click a folder in Source Control Explorer and in the context menu that appears, click View History. Select a single changeset and in the toolbar near the top of the page, click the Track Changeset button.

You will be prompted to select any desired branches before clicking the Visualize button. Subsequently, the changeset diagram will appear and you can see how that if and where that changeset was merged across branches.

With the TFS 2010 upgrade, you can now grant/deny users the ability to merge or manage branches by right-clicking a folder and in the context menu that appears, click the Properties option. On the Properties page, click the Permissions button.

You can also view a list of any branch relationships by right-clicking a branch icon and in the context menu that appears, click the Properties option. On the Properties page, click the Relationships button.