Thursday, June 28, 2007

Windows Installer XML (WiX) 3.0 Snippets

One of my tasks at DITR is the creation and refining of WiX packages. 

We are currently using Beta 3.0 which has proven to be quite a challenge as there are not many examples available to assist the novice WiX deployer (which I am).  There are however heaps of v2.0 examples available that only need some minor modifications to make them work correctly under 3.0.

As I’ve spent a great deal of time researching and trialing different techniques, I thought I’d post some snippets to assist those looking for similar functionality.  These snippets may not be 100% perfect, but they work and will give you a head start on using this great toolset.

To use these examples you must include the following namespace declarations in your WiX project:

<?xml version="1.0" encoding="UTF-8"?>

<!—
Add the xmlns:iis attribute to allow access to WIX IIS functions (Requires WixIIsExtension reference)
Add the xmlns:util attribute to allow access to WIX util functions (Requires WixUtilExtension reference)
-->

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
       xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension"
       xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
</Wix> 

There is also a bug in the IDE version of the WiX which does not persist the “Cultures” property (found on the Linker Tab of the Project Properties dialog) in the “.wixproj” file meaning that you will get an error when trying to use these namespaces.  You need to open the “.wixproj” file for your project in notepad and set the “Cultures” attribute to “en-US” (or whatever culture you are using for your project) in both the ‘Debug’ and ‘Release’ nodes:

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
      <Cultures>en-US</Cultures>
</PropertyGroup> 

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
      <Cultures>en-US</Cultures>
</PropertyGroup> 

Define Default User/Service Account

<!--
The Account Name ([SERVICEACCOUNT]), Password ([SERVICEACCOUNTPASSWORD]) and Domain/Server Name ([SERVICEDOMAINNAME]) are gathered via a custom dialog. 

We can then use this default account in any area of our WiX that requires a User    Account by referencing serviceAccount.
-->

<util:User Id ='serviceAccount' Name='[SERVICEACCOUNT]' Password='[SERVICEACCOUNTPASSWORD]' Domain='[SERVICEDOMAINNAME]' ></util:User>

Define Default Web Site Properties

<!-- Web site is only created if it doesn’t already exist -->

<iis:WebSite Id='DefaultWebSite' Description='Default Web Site'>

<iis:WebAddress Id='AllUnassigned' Port='80' />

</iis:WebSite>

Define Default Virtual Directory Properties

<iis:WebDirProperties Id='WebVirtualDirProperties' Execute='yes' Script='yes' Read='yes' WindowsAuthentication='no'

AnonymousAccess='yes' AnonymousUser='serviceAccount' IIsControlledPassword='yes'/>

Create an Application Pool in IIS 6.0

<Component Id='C_MyAppPool' Guid='3C06911D-C31A-427E-8CA6-AEFC65161B1A' >

      <iis:WebAppPool Id='MyAppPool' Name='MyAppPool' Identity='other' User='serviceAccount' >

      </iis:WebAppPool>

</Component>


Create a Virtual Directory using Application Pool in Default Web Site

<!--
TARGETVDIR is the name of the Virtual Directory for this site.
TARGETDIR is the directory location of the files for the site.
-->

<Property Id="TARGETVDIR" Value="AuthenticationWebService" />

<Component Id='C_VirtualDirComponent' Guid='{A598E09C-B770-4df2-BE08-E069A718B938}'>

      <iis:WebVirtualDir Id='VirtualDir' Alias='[TARGETVDIR]' Directory='TARGETDIR'

WebSite='DefaultWebSite' DirProperties='WebVirtualDirProperties' >

      <iis:WebApplication Id='WebApplication' Name='[TARGETVDIR]' WebAppPool='C_MyAppPool'/>

      </iis:WebVirtualDir>

</Component>

Update an XML Configuration File

<!--
TARGETDIR is the directory location of the files for the site.
The SERVICEENDPOINT attribute below is used to match an input control on a EnterConfigurationValuesForm dialog box (which you need to define).                             

Tip: The Value attribute below can be used as a command line arguement when running the MSI from the command line. For example:                             

msiexec /i C:\ActivityAuditSetup.msi SERVICEENDPOINT=http://localhost:8005/TimeStampService/service /quiet
-->

<Component Id="C_ConfigFile" Guid="{8943581F-D07B-49f4-AF09-23541F7EB2F7}">

   <util:XmlFile Id='ModifyServiceEndPoint' Action='setValue'

      ElementPath='/configuration/system.serviceModel/client/endpoint[\[]@name="S113"[\]]'

      Name='address' File='[TARGETDIR]web.config' Value='http://[SERVICEENDPOINT]:8113/MyService/Service' />

</Component>

Add a Registry Entry 

<Component Id="C_EventLogReg" Guid="{05F254DE-E990-4FD6-86B7-11200B148B36}">

   <RegistryKey Root="HKLM" Key="SYSTEM\ControlSet001\Services\Eventlog\Application\Wcf_S113"

      Action="create" />

   <RegistryValue Root="HKLM" Key="SYSTEM\ControlSet001\Services\Eventlog\Application\Wcf_S113"

      Action="write" Name="EventMessageFile" Type="expandable"

      Value="C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\EventLogMessages.dll"/>

 </Component>

Install a Windows Service

<Component Id="ProductComponent" Guid="{ED4F5E2A-D8B6-42e7-9330-9282AA76BB50}">

<File Id='ServiceExeFile' Name='AuthenticationBusinessService.Hosting.exe'

            Source='Files\AuthenticationBusinessService.Hosting.exe'

            KeyPath='yes' Vital='yes' DiskId='1' />     

      <File Id='AuthenticationBusinessService.Hosting.exe.config'                  

            Name=' AuthenticationBusinessService.Hosting.exe.config'

Source='Files\AuthenticationBusinessService.Hosting.exe.config'

Vital='yes' DiskId='1' />

      <!-- IMPORTANT: ServiceInstall Id and Name MUST MATCH SerivceControl Id and Name -->

<ServiceInstall Id='ServiceExeFile'

      DisplayName= Authentication Business Service' Name='AuthenticationBusinessService'

      ErrorControl='normal' Start='auto' Type='ownProcess' Vital='yes'

      Description='Authentication Business Service'

      Account='[SERVICEACCOUNTUSERNAME]' Password='[SERVICEACCOUNTPASSWORD]' /> 

<ServiceControl Id='ServiceExeFile'

      Name='AuthenticationBusinessService'

      Start='install' Stop='both' Remove='uninstall' Wait='yes' />

</Component>

How Windows Server 2003 Temp Files Can Kill Applications Using X509 Certificates

Over the last few days we've wasted a lot of time tracking down the cause of poor application performance. The application was running fine when all of a sudden it started to run like a dog. Well, perhaps I should define "all of a sudden".

We finished redeploying to our pre-prod environment after it had been partially rebuild for pilot go-live when we noticed that transactions were taking over a minute to complete. Baffled by this problem we developers concluded that it must be an infrastructure problem as our code base had not changed since the first test deployment (guaranteed as we were deploying using CD's cut during the first deployment exercise) and the infrastructure had been rebuilt and full load balancing and prod X509 certificates had been implemented. The infrastructure team kindly pointed out that previous deployments had not worked due to miss-configuration of app and web config files so that was more than likely the cause of this problem. Anyway, once we'd had enough of the finger-pointing, we decided to look into this issue more seriously as it was a show-stopper.

After switching off load balancing on our Web and Application servers, running traces on SQL Server and network traffic between the application tiers, switching on full WCF and application tracing and logging, and testing different X509 Certificates, we were finally able to alleviate problems with the infrastructure and pinpoint a line of code that looked like the cause of our woes. So we thought! BTW, the offending line of code was a simple call to create a X509Certificate2 object (which is part of the System.Security.Cryptography.X509Certificates managed class).

There were a number of additional tests conducted after this phase but I don't want to bore you with the details so I'll get on with the solution.

One of the developers (Pravin Bhatia) launched Google (as all good developers should) and started searching for items relating to "X509Certificate2 Performance Windows 2003". He eventually stumbled across this KB Article on Microsoft: "On a Windows Server 2003-based client computer, the system does not delete a temporary file that is created when an application calls the 'CryptQueryObject' function". Now, I know you are probably thinking "What the hell does this have to do with the reported issue!". As you know, titles given to MS KB Articles don't always reflect the full issue at hand, so it's always best to read them, especially if Google has presented it as a hit for your query.

What this article talks about is the fact that a "A temporary file of 0 bytes is created in the %windir%\Temp folder and this temporary file is not deleted when the CryptQueryObject function finishes its task. Additionally, when the number of temporary files reaches about 65,000, the call to the CryptQueryObject function takes longer than expected to finish." In the "More Information" section of the article (which is located at the bottom!), it states "This problem is more apparent when the CryptQueryObject function is called either directly or indirectly from a server application through some intermediate layer. When the number of temporary files reaches 65,000, client computers experience significant delays. A known indirect caller of the CryptQueryObject function is the constructor of the System.Security.Cryptography.X509Certificates.X509Certificate2 managed class.". Bingo!

Happy with his find and with the assurance of an excited Development team, Pravin raced down to the server room and checked the %windir%\Temp folder only to find that there were 4 files in this directory. Pravin returned with a look on his face that resembled that of a child who had just dropped their ice-cream in the dirt. All was not lost though.

After a few minutes of deliberation I suggested that we should also check the temporary folder of the account hosting the service (usually located in "c:\Documents and Settings\[ServiceAccount]\Local Settings\Temp"). Guess what? There were 65536 files in this directory. After deleting these files our application performance returned to normal.

Amazing how such a simple problem can cause so much pain. I wonder how many people have been hit by this type of issue once in production. We were lucky that this happened to us in pre-prod and we still had access to the servers and logs otherwise this would have been an absolute nightmare (not to say that it already wasn't) to track down in a fully locked down environment. The issue with this type of problem is that it doesn't happen all the time on all servers. We've never had it happen in our Dev and Test environments and we've been doing this for at least 4 months.

There is a hotfix available for this issue, however it's not available for download and only available via submitting a request to Microsoft.

Saturday, June 23, 2007

Windows Server 2008 Developer Focused Readiness Event

Anthony Borton has provided some details on the Tech Talk Blog about the Microsoft Technical Readiness Team doing a Windows Server 2008 developer focused readiness tour commencing on 10th September 2007 in Sydney. The cool thing is that they are actually stopping over in Canberra on 1st-2nd October 2007.

The course content is the final stages of completion and will be published on the registration site as soon as it is available. Here's a preliminary list of some of the sessions that will be presented during the tour:

  • Developing custom modules and handlers for Internet Information Server 7.0
  • Developing an Administrative interface using Microsoft Management Console 3.0
  • How to use the new Transactional NTFS capabilities in your application
  • Creating custom cmdlets for PowerShell
  • Windows Eventing 6.0
  • Windows Communication Foundation
  • Windows Workflow Foundation
  • Windows Eventing 6.0 & Performance Counters
I'm obviously looking forward to the Windows Communication Foundation and Windows Workflow Foundation topics as this is the space I'm playing in at the moment, but I'm sure the other content will provide valuable information for developers targeting the Windows Server 2008 platform.

Looking forward to seeing more updates on this tour.

Friday, June 22, 2007

alli: Miracle diet pill with teeny-tiny side effect

This has nothing to do with I.T. related stuff but is so funny you gotta read it. My stomach is still hurting from all the laughing.

Enjoy!

alli: Miracle diet pill with teeny-tiny side effect

Thursday, June 21, 2007

TLG Application Details for Tech-Ed on the Gold Coast!

Republished on behalf of Hynesite

As valued professionals, we're inviting MCTs and MVPs to apply for the position of Technical Learning Guide (TLG) at TechEd Australia 2007 in the Gold Coast. The last few years have proven the worth of this group of experts in this role supporting the Hands-On Labs and we strongly encourage you to apply this year.

As with previous years, we'll be calling upon the skills that have earned you your titles of MCT and/or MVP to generally assist attendees in the lab environments. TLGs in the Hands-On Lab rooms assist attendees in the use of the environment, finding labs and with difficulties they may encounter.

This year, we are also supporting Instructor-Led Labs throughout the show and as with the Hands-On Labs we will appoint TLGs to support these rooms. We are seeking instructors for these labs so please indicate on your application if you would be interested in fulfilling this role. Successful applicants for the instructor roles will have their scheduled time requirements reduced to reflect the additional preparation that is required. Additional details on the ILL Presenter role can be found in the attached document.

In return for 12 hours of your assistance in the lab rooms, you will be given a free pass to the show.

Please complete an application found on the foloowing newsgroups:

MCT: microsoft.private.mct.teched.anz
MVP: microsoft.private.mvp.anz

Please note the application period closes promptly, midnight, Sydney time, on June 29th. No applications will be accepted after this time.

Questions can be sent to tetlg@hynesite.biz

Looking forward to seeing and working with you at TechEd 2007 on the Gold Coast

Security Camp OZ 2007

SecurityCamp Oz is a FREE event open to all those interested in IT Security - it is being held in Wagga Wagga at the Charles Sturt University Campus on the weekend of October 13-14 2007.

There will be presentations by community and industry experts, plenty of chances to network with several hundred of your IT Security peers and even a free tasting of the universities famous range of wines and cheeses.

The Agenda for Security Camp OZ is still being finalized but one of the speakers that have already confirmed is Orin Thomas. Apart from being an associate editor for Windows IT Pro Magazine & a Security MVP, Orin has authored some of the world's most popular IT books including many of the core Microsoft Press Windows Server 2003 Training Kits. Orin is currently writing an Exchange Server 2007 Training Kit for Microsoft Press & will shortly start work on a Windows Server 2008 text - in his 'spare' time he is studying for a Ph.D.'

For further information and to register for the event vist http://www.securitycampoz.com/

Tuesday, June 19, 2007

Intel(R) PRO/Wireless 3945ABG Vista Driver Problems

While passing time in Qantas Club a few weeks back waiting for my flight to San Francisco, I downloaded a driver update for my Intel(R) PRO/Wireless 3945ABG Card from Dell Support and installed it on my D820. Not that I really needed to but I'm a patch junkie and need to have every possible patch installed on my machine.

Well, I've had nothing but troubles for the last 3 weeks with Wireless connections as the card spontaneously disables itself for no apparent reason and won't enable unless I reboot the machine. Thinking that I had a corrupt install and not being able to find the original install files, I headed back to Dell to download them again. What's this? The last update was in March 2007. No, that can't be right I thought to myself as I just downloaded a new version dated May 2007. I checked the version of the drivers on my D820 and they were 11.1.0.86 but the ones on the Dell Support Site are 10.6.0.29. What's going on!

I fired up Google (as usual) and typed in 'D820 Intel 3945ABG Vista' and found this. Yes, that's what's happening to me. But why?

Turns out that the drivers I had installed were for the D830 which I accidently downloaded while reviewing the specs on the newer model. Strange that this would cause this sort of problem on the D820 as they both use the same Intel PRO/Wireless Card. Anyway, have installed the older drivers and everything is sweet again.

Moral of this story: Keep installing patches but be a little more careful :-D

MEDC ANZ 2007 Downloads

Go to the MEDC site https://www.medc2007.com/public/ausdownloads to download all the resources, including speaker presentations and links to speaker blogs.

Monday, June 18, 2007

Genius in the Making



At 11 months old my daughter Lily has already mastered the art of booting a PC and using a keyboard and mouse. Could she be the next Kimberly Tripp or Kalen Delany? Hope so :-D

Saturday, June 16, 2007

Australian Tech-Ed Influencer Party 2007

I am proud to announce the inaugural Australian Tech-Ed Influencer Party.

The party will be held after the ‘Ask the Experts’ dinner on Wednesday 8th August. Registration to this free event is open to all MCT’s/MVP's and will include finger food and all you can drink* for three hours.

Registrations are essential as entry will be limited to ticket holders only. Proof of MCT/MVP status will need to be produced to collect ticket.

What is it: Australian Tech-Ed Influencer Party
When: Wednesday 8th August 2007 - 9pm 'till late (Add to Outlook Calendar)
Where: Howl at the Moon - http://www.howlatthemoon.com.au/
Registration: http://www.wardyit.com/
Enquiry's: jeff@wardyit.com


This event is proudly sponsored by:


Brisbane's Leading SQL Server Consultants Linking People with Technology Study Opportunities for Career Focused Academic Excellence IT Masters - The University Masters for IT Professionals


We look forward to seeing you at the inaugural Australian Tech-Ed Influencer Party.

Cheers
Jeff

* Free drinks limited to beer, wine, softdrink, juices and of course water

Saturday, June 09, 2007

Tech-Ed 2007 Orlando - Days 3-5

Well, Tech-Ed is over and I've got very sore feet. :-D

I really enjoyed my time here and I met and worked with a lot of great people. I had planned to blog every day but have found it hard to say anything other than the fact that I worked and slept. I didn't get a chance to have a good look around at the exhibits (as they were always closed when I had a free schedule) and only got to attend two sessions as I spent most of my spare time chatting with other MCT's and doing hands-on-labs (which were great by the way).

Even though it was pretty exhausting work, I would love to do this type of thing as a full time job. There's something about helping people learn and seeing the expression on their face when it all finally clicks; that's what makes all the pain and tiredness worth it.

I'd really like to get more involved in the MS Event's side of things, but there is a problem with this. I work for-the-man and need his permission to take time off to do so. Yes there is also the issue of money but there are ways to deal with this.

I've done a fair bit of thinking while away and wonder whether it's time for a career change. Not a complete change away from computers, but maybe a change in the direction of becoming a freelance trainer and developer. This would also give me the flexibility I would need to work at more MS Events. Moving to the U.S. would also help with this as there is a fair bit of work over here and it's also where all the good events are (and the ones MS helps with expenses!). Don't think I'll be able to talk the family into moving though so I'll probably just look into freelancing for now.

Cheers
Jeff

Thursday, June 07, 2007

Tech-Ed 2007 Orlando - Day 2

Didn't get to do much attendee stuff today as I spent most of Tuesday morning reviewing and fixing some problems with the WEB11 ILL and the rest of the day working. I did however get to attend a Chalk and Talk session on "Building Smart Client Applications Using Microsoft Synchronization Services for ADO.NET" where we discussed how to build offline smart client applications in a RAD way using a local Microsoft SQL Server Compact Edition and synchronising with a backend SQL Database using the Microsoft Synchronization Services for ADO.NET.

The last few hours of my day were spent sipping wine and geek talking with fellow MCT's at a party hosted by Ken Rosen (Worldwide Program Manager, MCT).

Cheers
Jeff
(Photo: Fellow MCT's resting up)

Tuesday, June 05, 2007

Tech-Ed 2007 Orlando - Day 1

Today was the opening of Tech-Ed and as expected, it was an amazing site and an experience I'll never forgot.

The keynote this year was very funny and contained a lot of tongue-in-cheek criticism of Microsoft Vision Speak Bullshit (or MSVSBS for short!). It was based around the movie Back to the Future (with replica car and video of spoofed up time travel) and stared Doc Brown (from the movie) and Bob Muglia (Senior vice President, Server and Tools Business, Microsoft) and set the scene for a Tech-Ed that was about technologies available now, not those that may be available in the future. The key behind the message was that Microsoft understands that people are sick of hearing about the future and promises that don't always eventuate; thus the emphasis on now.

Most of my day was consumed by TLG duties, however I did get to attend a session on "SOA16 - Automatic Transactions in Windows Communication Foundation" and have a chat with the guy's on the WCF booth about an issue we're having at work around using https and WCF.
Session

The session I attended looked into ways to compose transactional Web services and integrate them with System.Transactions and database calls. We discussed how MSDTC needs to be configured to enable WS-AT and talked about various tools you can use to monitor and diagnose transactions-related issues.
WCF Booth

The issue we're having with WCF and https is that we have built some WCF Web Services that communicate via http. A load balancer has been placed at the firewall to these Web Services which requires all connections to be made via https. The LB accepts requests, decrypts the requests and passes them to the appropriate Web Services server via http. What this means is that the client needs to be configured to use a https endpoint however the service expects a communication via http; therefore you get an endpoint mismatch. The way around this is to configure the service endpoint address as https and then create a Listener URI which listen on http. You then configure the client endpoint and WSDL to use https. Simple! Just waiting for work to confirm this works or whether I need to do a bit more investigation.
TLG Duties

Apart from doing my shifts (8hrs in total...Ouch), I visited all the TLC booths (Technical Learning Center) so that I had an understanding about who they were and what they did so that I could direct attendees taking labs to people who could assist with further enquiries. Given that we are looking after so many attendees, we are only able to spend time helping with the labs and dealing with questions specific to the labs. All other questions are to be directed to TLC staff. Of course we assist beyond this requirement as much as possible (as the whole idea is to provide attendees with value and a great learning experience), however we just don't have the time to spend hours discussing the in's and out's of various technologies and how to deal with a particular issue/bug. The staff at the TLC booths are there specifically for that reason; to spend as much time as required to assist attendees.

All-in-all it was a great day. Attendees were very happy with the way things were traveling and many stated that this years labs were the best so far.
Today I do my first two Instructor Led Labs (IIL's) shifts ("WEB11 - Developing and Deploying Web Applications with Microsoft Internet Information Services (IIS) 7 in Windows Vista" and "MBL05 - Better Together: Microsoft Exchange Server 2007 and Microsoft Windows Mobile 6") and another TLG shift. I also plan to attend three sessions:
  • DEV324 - The .NET Language Integrated Query (LINQ) Framework
  • DAT14-TLC - Building Smart Client Applications Using Microsoft Synchronization Services for ADO.NET
  • SOA316 - Secure Your ASP.NET Web Applications and Microsoft Windows Communication Foundation Services with Windows CardSpace
Hope my feet are up too it :-D

Monday, June 04, 2007

Tech-Ed 2007 Orlando - TLG Training Day

Well, I finally made it to Orlando (after 25hrs of flying and stop-over's) and today was our TLG training day where we spent time discussing our role, meeting staff/crew and reviewing labs.

My primary role will be to assist attendees with WEB, DEV and SAO labs. I'm also helping out with 4 Instructor Led Labs ("Microsoft Exchange Server 2007 and Microsoft Windows Mobile 6", "Developing and Deploying Web Applications with Microsoft Internet Information Services (IIS) 7 in Windows Vista" and "Building Windows Presentation Foundation Applications") which, as the name suggests, are labs conducted in a classroom environment by an instructor which is a new concept for Tech-Ed.

There's not much more I can say about today as it was basically a training day with no Tech-Ed content or exhibits open (except for the Pre-con deep dives of course). I will say this though, the conference centre is friggin' huge! No doubt tomorrow's opening is going to be spectacular. Just the mere fact that approximately 13,500 attendees will be arriving is something I'm not going to forget for a very long time......

Cheers
Jeff

P.S. The photo above is of the TLG's (minus me) that are working the Web, Dev and SOA labs.

Friday, June 01, 2007

WARDY IT Solutions - May SQL Server Newsletter

The May 2007 edition of the WARDY IT Solutions SQL Server Newsletter has been e-mailed to everyone on the distribution list. For those not on the distribution list you can view the newsletter using the following URL http://www.wardyit.com/newsletters/may2007.htm.
To subscribe to the newsletter send an email to newsletter_add@wardyit.com.