Thursday 9 July 2009

Data driven tests with MSTest

You can use CSV or Excel documents as data sources to drive parameterised unit tests with MSTest. For the following class:

    3     public static class MyWidget

    4     {

    5         public static int MyBusinessLogic(int valueA, int valueB)

    6         {

    7             return valueA * valueB;

    8         }

    9     }

You can write the following unit tests:

    3     using System;

    4 

    5     using Microsoft.VisualStudio.TestTools.UnitTesting;

    6 

    7     [TestClass]

    8     public class MyWidgetTests

    9     {

   10         [TestMethod]

   11         [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "MyWidgetTests.csv", "MyWidgetTests#csv", DataAccessMethod.Sequential)]

   12         public void TestMyBusinessLogicWithCsv()

   13         {

   14             int valueA = Convert.ToInt32(TestContext.DataRow["valueA"]);

   15             int valueB = Convert.ToInt32(TestContext.DataRow["valueB"]);

   16             int expectedResult = Convert.ToInt32(TestContext.DataRow["expectedResult"]);

   17             int actualResult = MyWidget.MyBusinessLogic(valueA, valueB);

   18             Assert.AreEqual(expectedResult, actualResult, "The result returned from the widget was not as expected.");

   19         }

   20 

   21         [TestMethod]

   22         [DataSource("System.Data.Odbc", "Dsn=Excel Files;dbq=|DataDirectory|\\MyWidgetTests.xlsx", "MyWidgetTests$", DataAccessMethod.Sequential)]

   23         public void TestMyBusinessLogicWithExcel()

   24         {

   25             int valueA = Convert.ToInt32(TestContext.DataRow["valueA"]);

   26             int valueB = Convert.ToInt32(TestContext.DataRow["valueB"]);

   27             int expectedResult = Convert.ToInt32(TestContext.DataRow["expectedResult"]);

   28             int actualResult = MyWidget.MyBusinessLogic(valueA, valueB);

   29             Assert.AreEqual(expectedResult, actualResult, "The result returned from the widget was not as expected.");

   30         }

   31 

   32         public TestContext TestContext{ get; set; }

   33     }

Notice the two unit tests are identical save for the test name and the “DataSource” attribute. The code is pretty self explanatory, the two tests are driven by data from different sources. The only things to note are the presence of the “TestContext” and the contents of the Data Source.

For CSV sources (the first in the example):

  • “Microsoft.VisualStudio.TestTools.DataSource.CSV” specifies the data source type.
  • “MyWidgetTests.csv” is the connection string and needs to be name of the file to read the values from.
  • The “MyWidgetTests#csv” value is the “table name”. When using files, it needs to match the filename, with a hash (“#”) instead of the period (“.”).

An example file is as follows:

image

For Excel sources (the second example):

  • “System.Data.Odbc” specifies the data source type.
  • “Dsn=Excel Files;dbq=|DataDirectory|\\MyWidgetTests.xlsx” is again the connection string, replace your filename accordingly. The “DataDirectory” value is replaced by the MSTest framework and points to the directory the tests are run from.
  • The “MyWidgetTests$” value is the “table name”. When using Excel files, it needs to to be the name of the of the Worksheet containing the data (see below).

An example file is as follows:

image

Note the you can have multiple Worksheets in a single Excel file, this means you can drive different tests from the same Excel file.

You will need to have the CSV and Excel files set as deployment items in the Test Run Config:

image


Wednesday 13 May 2009

Tip for clearing disk space under Windows

After going through the usual suspects* for clearing disk space you can normally squeeze some more space by deleting the folder “%SystemDrive%\Windows\SoftwareDistribution” (you need to stop the “Automatic Updates” Service first).

* Usual suspects are:

  • Use “Disk Cleanup” (find under System Tools).
  • Delete any files you don’t need under “%SystemDrive%\Windows\System32\LogFiles”.
  • Delete any old user profiles (“Advanced” tab in Properties of My Computer), note the reported size of the profile used is usually an outright lie and the space taken up by each profile is normally much bigger.
  • If you are running SQL Server, truncate the Log files, move the Data and Log files to another drive.

Thursday 30 April 2009

Load Testing with Visual Studio Team System

Visual Studio Team System offers a lot functionality for automated testing. While you can write unit tests with MSTest in “Visual Studio 2005/2008 Team Edition for Developers” you’ll need “Visual Studio 2005/2008 Team Edition for Testers” to author Web Tests and Load Tests.

Web Tests are essentially a script to execute against a web site, a Load Test can execute one or more Web Tests with a set of parameters. These parameters can be:

  • User count (this can ramp up and down)
  • Browser mix (IE 5.5/6.0/7.0/8.0, Firefox 2.0/3.0 and Netscape 6.0 plus Smart Phone and Pocket PC)
  • Network mix (LAN, Cable, dial-up)

Once you have authored your Web and Load Tests you can run the Load Tests from “Visual Studio 2005/2008 Team Edition for Testers”. In this scenario you are limited in that you can only simulate a limited number of users (exact number depends on your machine). To scale out and simulate the load of many thousands of users you can use the “Visual Studio Team System 2005/2008 Test Load Agent”. This is available as a separate product, download a 90 day trial here:

http://www.microsoft.com/downloads/details.aspx?FamilyID=572e1e71-ae6b-4f92-960d-544cabe62162&displaylang=en

The “Visual Studio Team System 2005/2008 Test Load Agent” allows you to set up Test Agents and Test Controllers. Test Agents simulate requests from Users and Test Controllers orchestrate the Test Agents.

LoadTestingWithVSTS

According to the documentation, a Test Agent on a server with a 2.6 GHz processor and 2GB RAM can simulate approximately 1000 virtual users. A single Test Controller installed on a similar specification server can orchestrate approximately 30 Test Controllers. These numbers are approximate as the specifics will depend on your web application. If your web application is graphics heavy you will not be able to simulate as many users to due to increase memory demands of the requests for larger pages.

These are very rough numbers, but if your average web page size is 300KB and you have 1000 virtual users simulated per Test Agent, the server running the Test Agent needs to deal with up 300MB worth of requested data at once. The load on each Test Agent is mitigated in that the Test Agent simulates user thinking times (times are configurable in the scripts). So each machine won’t be making 1000 requests constantly, more like 1000 requests every 4 or 5 seconds. So a server with 2GB RAM supporting 1000 virtual users seems a reasonable basis for estimates.

If you want to simulate 10,000 users you would need:

1 Test Agent per 1000 virtual users = 10 x Test Agents = 10 x servers

1 Test Controller per 30 Test Agents = 1 x Test Controller = 1 x servers

This means a total of 11 servers, each with 2.6GHz processor and 2GB RAM.

You can find more information on the metrics here: http://msdn.microsoft.com/en-us/library/ms253092.aspx


Thursday 23 April 2009

Test from Live Writer now I can install it to Windows Server 2008

With a bit of luck of I should be able to post some pretty pictures…

Test

And that’s me off to my ivory tower…


Friday 3 April 2009

April News

Last month Microsoft held its annual MIX conference in Las Vegas. The MIX event is similar to the MSDN conference but the content is targeted towards Microsoft’s web platforms. The event saw a lot of news about Silverlight, the highlight being the official announcement on Silverlight 3.0. The beta for this was made publicly available during the conference. The conference also saw the final release of Microsoft’s ASP.NET MVC framework and further announcements on Windows Azure.

Microsoft News

·         The widely expected announcement of Silverlight 3 Beta was confirmed at the MIX conference along with betas for the necessary tooling for Visual Studio and the Expression Blend designer suite. New features in Silverlight 3 include support for higher quality video and audio, 3D graphics, hardware acceleration, animation effects, improved accessibility for partially sighted people, Search Engine Optimisation (SEO) and a whole raft of changes to enable a richer user experience. Silverlight 3 also supports an “out of browser” experience meaning Silverlight application can be hosted outside of the browser frame and effectively become rich desktop applications delivered by the web. The Register has an analysis of Silverlight versus the rival Air/Flash combination from Adobe, details here, here and here.

·         Silverlight has also seen an additional large scale application in the form of Microsoft WorldWide Telescope.

·         Silverlight also sees further platform support with tooling for the popular Eclipse development environment. With Moonlight (the open source implementation of Silverlight supporting Linux platforms), Silverlight’s own compatibility with the Mac operating system and Firefox and Safari web browsers its and even more compelling cross platform solution, offering the benefits of a rich user experience and ease of deployment for web applications.

·         Microsoft’s next client operating system, Windows 7, which had a beta release back in February will likely reach Release Candidate in May.

·         The final of Internet Explorer 8 has been released.

·         Microsoft’s ASP.NET MVC framework has been released. Interestingly this is has been released under Microsoft Public License which is an OSI approved license. This could be the first steps of Microsoft embracing open source software.

·         Windows Azure development continues to gather momentum. Microsoft announced plans to deliver core relational database features as part of SQL Data Services (the data access service for Windows Azure). The is equivalent to SQL Server in the cloud and porting applications to this platform should be as simple as “changing your connection string”. Further analysis on SQL Data Services from The Register here. Microsoft will imminently roll out Windows Azure to multiple data centres in North America. A European data centre (most likely in Ireland) is in the pipeline.

·         Microsoft’s interactive table top display technology, Surface, is also slowly gaining traction. BMW have found another commercial application for the product.

·         Microsoft released more details of their Windows Marketplace for Mobile offering which allows developers to sell applications through a Microsoft portal. Developers will keep 70% of the sales revenue.

Community & Industry News

·         The UK Azure User Group had its inaugural meeting on 31st March. Members of the Microsoft Azure team spoke and did a couple of demos. Some useful information was made available, the pricing and SLAs will be announced this summer and the Azure will go commercial in Q4 this year. The next event will be on the 14th May, more information here.

·         IBM to buy Sun Microsystems?

Articles & Blogs

·         Scott Guthrie’s MIX wrap up.

·         Somasegar gives us a recap on the .NET tooling we have had post VS2008.

·         Microsoft are building a framework for composing web applications with Silverlight and ASP.NET using Domain Driven Design principals. The framework is at a very early stage and has been labelled .NET RIA Services. RIA meaning Rich Internet Applications. The framework offers a common approach to data access using Object Relational Mapping techniques and consistent validation rules on the client and server. The two MIX sessions are available here.

·         ASP.NET MVC and mobile web applications.

·         Scott Guthrie’s MIX Silverlight for Business Applications demo.

·         Channel 9 on Silverlight 3.0 for great business applications.

·         Windows Azure applications now run with Full Trust.

·         Visual Studio 2010 will see a deployment framework called MSDeploy. This will be used to seamlessly deploy web applications dealing with the all dependencies down to the IIS settings.

·         A list of Microsoft Product Teams on Twitter.

·         Udi Dahan looks at making better Domain models, “From CRUD to Domain Driven Fluency”.

·          Improving Session Factory Initialisation in NHibernate.

·         SQL Server SCOPE_IDENTITY() sometimes returns incorrect value.

·         In case anyone was wondering, the technology that was originally Microsoft BizTalk Services is now the .NET Services component of Windows Azure. This includes a Service Bus that can traverse firewalls (built with Windows Communication Foundation), Access Control (built with Microsoft’s CardSpace) and workflow (built with Windows Workflow Foundation).

Downloads & Tools

·         ASP.NET MVC 1.0 has been released.

·         Silverlight 3 SDK Beta 1 is available.

·         Windows Azure March CTP is available (this includes both the Tools for Visual Studio and the SDK).

·         PEX is a project from Microsoft Research that analyses your code and produces unit tests to test edge case scenarios.

·         Chess is another project from Microsoft Research that analyses multi-threaded code and produce unit tests to check for dead-locks and other problems with multi-threading.

·         ADO.NET Data Services (Microsoft’s REST framework) has a new CTP.

·         Web Service Studio is a tool that will allow you to invoke web services interactively, it supports WCF and REST.

·         Velocity is a true distributed cache from Microsoft, currently in beta. It’s final roadmap is yet to be defined but here is NHibernate support and Velocity will be included in ASP.NET 4.0. There is a Q & A available for Velocity.

·         The SQL Data Services component of Windows Azure has an SDK available.

·         The Live Framework (another component of Windows Azure) has had an SDK refresh with the April CTP.

·         The Windows Installer Clean-up Utility will help remove stubborn programs you might have difficulty un-installing.

·         ReSharper 4.5 Beta is available for download. Please note that version 4.5 is available as a free upgrade to people with a licence for version 4.1.

·         Accompanying the final release of ASP.NET MVC, is a version 1.0 release of the MVC Contrib project.

·         The session videos from the MIX conference are available for download here and here.

·         There’s an open source Database Versioning and Documentation Tool for Microsoft SQL Server available on CodePlex.

And finally...

·         Ever had a frustrating call to a tech support centre? Now there’s an un-official “handshake” to let them know you’re not a luddite.

·         Interesting news that Skype is the world’s biggest international telco, accounting for 8% of the world’s talk time.


Wednesday 1 April 2009

Windows Azure costs for developers

I attended the first meeting of the Azure User Group UK tonight (http://ukazurenet.com/) and an interesting question popped up. Right now you can register for Azure for free to work with the CTP releases (http://go.microsoft.com/fwlink/?LinkID=129453). However, eventually Microsoft will monetise this service. SLAs and pricing should be published this summer and you will have to pay for services come Q4 2009. 

At this point what happens to developers who might be putting together proof of concepts or prototypes, or for projects still in the development stage? Well, it was suggested by a Microsoft employee that access to Windows Azure may be included in a Visual Studio license or MSDN Subscription. I think this is a pretty good solution to the problem.

Saturday 28 March 2009

Everything you ever wanted to know about Solid State Drives

I am making a very conscious effort not to be a link blog and I do my best to make each post meaningful in some way. I am making exception here with a great article on Solid State Drives (SSDs). Its from AnadTech, and tells you pretty much everything you need to know including a thorough explanation on the performance degradation these drives suffer from as they are used. The link is below and its worth reading from start to finish.


If you want the shorthand version, the Intel X25 drives look awesome and while performance will degrade over time the problem for these drives isn't nearly as bad as for the competitors (owing to some clever disk management). Even with the performace degradation the Intel X25 drives vastly outperform regular drives. Though you will pay a pretty price for one of the Intel ones.

Its worth noting that the "performance degradation" can be reversed if you do a "secure erase" of the drive i.e. completely wipe it. This is a complete wipe which is not equivalent to reformatting. Intel provide software with their drives to do this. As a developer I find I rebuild my machine every 6 months or so anyway so I'm not too worried about this performance degradation issue.

I found this link on the excellent "Joel on Software" blog which is also very hightly recommended reading:


Wednesday 18 March 2009

Error uninstalling ASP.NET MVC RC

I got an error trying to un-install the ASP.NET MVC Release Candidate (so I could install the final RTM 1.0 version). The process would fail with the error "There is a problem with this Windows Installer package...".

In the Release Notes for Version 1.0 there is a note mentioning possible conflicts with some Visual Studio Add-ins. Listed amongst them was Clone Detective. I un-installed this application and I was then able to un-install the ASP.NET MVC Release Candidate successfully.

If you are having issues, check the Release Notes to see if you have any of the Visual Studio Add-ins listed.

Wednesday 11 March 2009

"Error Synchronizing" with Exchange on Windows Mobile 6.1

This is a strange one. If you are set-up to receive SharePoint notifications and you get one in your Inbox this seems to prevent Outlook on Windows Mobile from synchronising with the Exchange server. Very odd. More details here:


No long term fix but if you delete the e-mail (you can delete on the handset) it will fix the problem and you will start to receive your e-mail again.

Tuesday 10 March 2009

Team Build in TFS2008 with a VS2005 Solution and FxCop

TFS2008 can build VS2005 Solutions owing to its backwards compatibility. Unfortunatey you might run into problems if you use FxCop in VS2005 and have this integrated into your Solution build i.e. FxCop runs automatically when you compile the project(s).

Very often you will recieve code analysis errors if you run a local Team Build (a "Desktop" build) at the command line even though you didn't see those errors when building in VS2005. This seems to be related to the setting of environment variables. To run a TFS2008 Team Build at the command line it must be done with an MSBuild v3.5 command prompt but your VS2005 is geared towards MSBuild v2.0.

To solve the problem, set the Environment variable "FXCOPDIR" to be "%programfiles%\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop" and your Team Build should complete okay. Rather than setting this value universally (and trashing VS2008 builds), what I normally do is have a command file with the following contents to run my Team Builds containing VS2005 Solutions:

@echo Setting environment variables
@set FXCOPDIR=%programfiles%\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop
"%systemdrive%\WINDOWS\Microsoft.NET\Framework\v3.5\msbuild.exe" path\TFSBuild.proj

This sets the environment variable for the current command window and executes the Team Build. The environemnt variable means FxCop will behave as if you were in VS2005 even though you are running a TFS2008 Team Build with MSBuild v3.5.

As as an aside, note that TFS2005 can't build VS2008 Solutions. "Forwards" compatibility has provided in TFS2008 meaning TFS2008 will be able to build VS2010 Solutions. This "forwards" compatibility has been implemented by allowing you to specify the MSBuild version used by your Build Agent. See Buck Hodges post for more information:


Monday 9 March 2009

Microsoft Tech Days 2009

Microsoft are running a 24 hour “virtual” learning event on 1st April with the sessions run via Live Meeting. The site promises over 90 sessions, there are currently 22 listed on the site and these are being added to as details are finalised. Currently listed sessions include:

·         ASP.NET MVC – Separation of concerns and unit testing

·         Complete control over Silverlight controls

·         Cranking ASP.NET Performance to 11...the easy way!

·         How WPF and databinding are best friends

·         In-depth MVC

·         Information Architecture for a MOSS intranet

·         Intro to LINQ

·         Maintaining Resilient Code: Using Tools From Microsoft's DevLabs and Research Sites

·         Professional SharePoint Development - Taking the Step From SharePoint Cowboy to Enterprise Team Development

·         SharePoint Workflow for the Masses

·         Silverlight apps need data... and here's how to get it!

·         Site Provisioning Solutions (for SharePoint)

More information and registration: http://www.msfttechdays.com/public/home.aspx

Once you register you can build a schedule.

Saturday 7 March 2009

NHibernate performance improvements

I picked up a couple of ideas off the ALT.NET mailing list.
These optimisations are only relevant when you have hundreds of entities.


Tuesday 3 March 2009

March News

This month sees a bag full of Silverlight news. Silverlight is Microsoft’s technology for building cross platform “Rich Internet Applications” and is delivered via a small browser plug-in (similar to the way Adobe Flash works). It provides developers with an subset of the .NET Framework that will run in several different web browsers (Internet Explorer, Firefox, Safari) and several different platforms (Windows, Mac, Linux). Silverlight’s cross platform compatibility and ease of development using the familiar .NET platform makes it a compelling solution for delivering applications to both the enterprise and public internet. There are already some large scale, high profile, implementations. Silverlight powers Photosynth, which I talked about last month.

Microsoft News

·         During a mid-quarter update to investors, Steve Ballmer announced that Office 14 (the next version of the flagship productivity suite) will not be available until next year. He also admitted that the open source “OpenOffice” product had forced Microsoft to lower its world-wide pricing for Office. The release of Office 14 will be accompanied by new versions of SharePoint and Exchange. Ballmer also talked about a low cost version of Windows Server, called “Windows Server Foundation Edition”, which is aimed at OEMs who make cheap hardware. This is most likely to help Microsoft penetrate the hosting and web server environments still dominated by Linux. More information on Windows Server Foundation Edition can be found here.

·         Microsoft held an MSDN Developer Conference in San Francisco during the week beginning 23rd February. One major announcement was that Microsoft will provide full SQL Server capabilities to Azure though there is some confusion on exactly what this entails. Another thing that did come to light was that Surface, Microsoft’s interactive table top display technology also mentioned last month, will be available in Windows 7 in that Windows 7 will have multi-touch technology and the same APIs. Little fan-fare has been made about this news but it is significant – this will take Surface adoption to the mainstream.

·         One new announcement is expected at the MIX09 event in Las Vegas (18-20th March) and that is details of Silverlight 3.0. We already know that Silverlight 3.0 will provide major media enhancements (including H.264 video support, 3D effects and hardware acceleration) in addition to richer data binding and more built-in controls.

·         Tim Sneath (Director, Client Platform Evangelism) counters some PR regarding Adobe’s “Air” product (a direct competitor to Silverlight). A follow-up blog details some large and high profile Silverlight projects including the web client for AOL Mail which prove Silverlight’s suitability for the main stream.

·         Continuing the Silverlight news, Moonlight (the open-source implementation of Silverlight) has had an official Version 1.0 release. Moonlight enables Silverlight on the Linux platform. In addition, Microsoft has provided the licensed media codecs for Silverlight compatible media as a free download for all Linux users. More information on Moonlight can be found in the official FAQ, the official press release and The Register’s take.

·         Silverlight is also compatible with Google’s Chrome browser. Though unofficial at the moment, the smart money says Microsoft will support this eventually. This will give Silverlight compatibility to all browsers that have a notable market share.

·         At the Mobile World Congress 2009 event in Barcelona, Microsoft officially announced Windows Mobile 6.5 and the My Phone and Market Place applications mentioned in last month’s news. My Phone provides a free on-line back-up service for Windows Mobile users. Market Place is a web site which ISV’s can use to sell their Windows Mobile applications, similar to Apple’s AppStore for the iPhone.

·         Even though Windows Mobile 6.5 has only just been announced, news is starting to filter through about the next release, Windows Mobile 7. It is due next year and will see further convergence of technologies in the Windows and Windows Mobile platforms.

·         Microsoft Office Labs takes a look at the future with a video montage of some prototypes floating around at Microsoft.

·         Developers should look at the latest MSDN Flash for details of upcoming web casts, events and new downloads. You can subscribe to the MSDN Flash email.

Community News                                                                                                                                       

·         The ALT.NET community has announced a conference in the north of England.

·         The CodeBetter website now hosts an instance of TeamCity to provide Continuous Integration for open source projects like NHibernate. Unfortunately I can’t find a “build output” location.

Articles & Blogs

·         Scott Hanselman on Moonlight.

·         A look at VS2010 with WPF front end.

·         The ASP.NET MVC tutorials have been updated, this technology has reached Release Candidate.

·         Microsoft have also documented the steps to build a sample ASP.NET MVC application.

·         A complete overview of testing in Visual Studio 2008.

·         Martin Fowler updates his “Technical Debt” article.

Downloads and Tools

·         The Release Candidate for Service Pack 2 for Windows Vista has been released to TechNet and MSDN Subscribers. The final version will be available in Q3 2009.

·         Silverlight 2 GDR1 - http://www.microsoft.com/silverlight/resources/install.aspx.

·         Live Framework Jan CTP - http://neuronspark.com/code/live-framework-tools/.

·         Azure Services Training Kit - February Update - http://www.microsoft.com/downloads/details.aspx?FamilyID=413E88F8-5966-4A83-B309-53B7B77EDF78&displaylang=en.

·         JQuery Version 1.3.2 has been released. You can use this for intelli-sense in Visual Studio. There are examples for using JQuery ASP.NET MVC.

·         Rhino Mocks for Silverlight - http://ayende.com/Blog/archive/2009/02/04/rhino-mocks-3.5-ndash-silverlight.aspx.

·         Windows Developer Power Tools - http://www.windevpowertools.com/default.aspx (a list of useful developer tools).

·         Fiddler - http://www.fiddlertool.com/fiddler/ (allows you to inspect HTTP requests/responses on your local machine).

And finally...

·         Google Latitude.

·         At last, a .NET tool converted to Java (rather than JSomething becoming NSomething).


Monday 23 February 2009

Kerberos, Delegation and SQL Reporting Services

Here is a very quick overview of the Service Principal Names (SPNs) you need set-up to get SQL Reporting Services working.

Assumptions:
  • Domain Functional Level is "Windows 2003".
  • SQL Reporting Services and SQL Server (the database engine) are installed to different machines.
  • Your domain is "acme.com".
  • The account running SQL Reporting Services is "acme\SQLReportingServices" (it does not matter which account SQL Server is running under).
  • SQL Reporting Services should NOT be run under a system account ("Local System" or "Network Service").
  • Your SQL Server machine name is "SQL01".
  • Your SQL Reporting Services machine name is "RPTS01".
  • The SQL Server instance holding the database is running on the default port (1433).
You should create four SPNs with "setspn.exe" as follows:
  • setspn -a MSSQLSvc/SQL01:1433 acme\SqlReportingServices
  • setspn -a MSSQLSvc/SQL01.acme.com:1433 acme\SqlReportingServices
  • setspn -a http/RPTS01 acme\SqlReportingServices
  • setspn -a http/RPTS01.acme.com acme\SqlReportingServices
You can substitute values to match your environment given the assumptions above. Note the capitalisation of the Service Class prefixes of the SPNs ("MSSQLSvc" and "http"). These are important.

After you have set-up the SPNs, the "acme\SQLReportingServices" account should be trusted for delegation against those SPNs. This is done in the Properties of the User Account object in Active Directory.

Please note it is best practice to set SPNs against dedicated Domain accounts rather than machines (as per above example). Having SPNs registered to Domain accounts allows you to enable Kerberos delegation in a load balanced environment. If your SPN is registered against a machine you can't delegate from other machines so you can't load balance. Services you wish to enable for delegation should not run under "Local System" or "Network Service". If the service is running under such an account, you have to set the SPN against the machine which limits your options for load balancing.

"setspn.exe" is available in the Windows Server 2003 Support Tools, more information here:


Delegation with Kerberos can be tricky at times. It makes complete sense when you get your head around it but the initial learning curve can be steep. The first thing to do is understand your network "hops". A "hop" is a call between services on which the clients credentials will be passed on the clients behalf.

A great document for understand and troubleshooting Kerberos can be found here:


About Me