Friday, October 29, 2010

Find all possible parameters for an MSI package installation using msiexec

While working on a library of powershell scripts to do unattended installations of BizTalk applications (and all adjacent files and packages) I needed to find out how to specify the settings for an MSI package in order to do a complete unattended install of it using msiexec.exe.

The MSI I was working with was a setup package for a WCF service. Since this installs to the IIS, both website, virtual directory as well as application pool is needed to be specified during the installation. The question is, what are the correct parameter switches for setting these?

Simple enough, these can be found by doing an install of the MSI and logging a verbose output to file. First, run msiexec with logging enabled:

msiexec /I package.msi /L*V installationlog.txt

Then look in the logfile for the text PROPERTY CHANGE. In the following example, the virtual directory is set using the property TARGETVDIR which then also can be used as a parameter to the msiexec command to set the property from outside the GUI:

Action start 15:41:42: WEBCA_TARGETVDIR.
MSI (c) (F4:8C) [15:41:42:943]: Note: 1: 2235 2: 3: ExtendedType 4: SELECT `Action`,`Type`,`Source`,`Target`, NULL, `ExtendedType` FROM `CustomAction` WHERE `Action` = 'WEBCA_TARGETVDIR'
MSI (c) (F4:8C) [15:41:42:943]: PROPERTY CHANGE: Adding TARGETVDIR property. Its value is 'MyWcfServiceLibrary'.
Action ended 15:41:42: WEBCA_TARGETVDIR. Return value 1.
MSI (c) (F4:8C) [15:41:42:943]: Doing action: WEBCA_SetTARGETSITE
Action 15:41:42: WEBCA_SetTARGETSITE.
Action start 15:41:42: WEBCA_SetTARGETSITE.

Note that the custom parameters are not to be set as normal switches with a leading slash /. In my case, the command will look like this:

msiexec /I package.msi /qb TARGETSITE="/LM/W3SVC/1" TARGET VDIR="MyWCFLibrary" TARGETAPPPOOL="BtsAppPoolC"

This will do a complete unattended install of the WCF service to IIS with basic UI and set the needed properties to my preferred values instead of the defaults.

Monday, October 25, 2010

Starting instance of host on server failed. / Could not create SSOSQL

Every now and then the BizTalk hosts won't start with the following message in the BizTalk Administration console:

Starting instance of host on server failed.
For help, click: http://go.microsoft.com/fwlink/?LinkId=47400&ProdName=Microsoft+BizTalk+Server+2009&ProdVer=3.8.368.0&EvtSrc=Microsoft.BizTalk.Administration.SnapIn.Properties.Errors&EvtID=HostInstance_UnmapServerHostInstanceFailed

ADDITIONAL INFORMATION:
Failed to start the BizTalk Host instance. Check the event log on the server "" for more details.
Internal error: "The dependency service or group failed to start." (WinMgmt)

The dependency that failed can usually be found by looking at the error message in the event log. Most likely you will find that the Enterprise Single Sign-On Service is unable to start with the following two messages:


Log Name: Application
Source: ENTSSO
Date: 2010-10-26 09:47:25
Event ID: 11047
Task Category: Enterprise Single Sign-On
Level: Error
Keywords: Classic
User: N/A
Computer:
Description:
Could not create SSOSQL. To fix the problem, reinstall SSO or try 'regasm SSOSQL.dll' from a Visual Studio command prompt.
Error Code: 0x80131700

Log Name: Application
Source: ENTSSO
Date: 2010-10-26 09:47:25
Event ID: 10503
Task Category: Enterprise Single Sign-On
Level: Error
Keywords: Classic
User: N/A
Computer:
Description:
The SSO service failed to start.
Error Code: 0x80131700

This can as the message describes most likely be fixed by registering the SSOSQL binary. What the message doesn't mention is that the version of regasm.exe that you have to run is different if you run 32 or 64 bit Windows.

For 32 bit OS:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe "C:\Program Files\Common Files\Enterprise Single Sign-On\SSOSQL.dll"

For 64 bit OS:
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\RegAsm.exe "C:\Program Files\Common Files\Enterprise Single Sign-On\SSOSQL.dll"

After registering the binary, the Enterprise SSO service can be started and subsequently also the BizTalk host instances.

Thursday, October 21, 2010

Recorded sessions from Applied Architecture Patterns now online

Today the recorded sessions from the BizTalk 2010 Release Party / Applied Architecture Patterns on the Microsoft Platform in Stockholm earlier this fall got released onto Channel9. They can be found at http://channel9.msdn.com/Tags/biztalk+user+group+sweden.

While they are all interesting, the one I'll check out first will probably be Pattern #4 – Cross Organization Supply Chain with a presentation on AppFabric caching which I feel can be an interesting implementation in many cases.

Saturday, September 25, 2010

BizTalk Server 2010 has shipped!

A few days late, but BizTalk 2010 is finally finished. The European BizTalk Conference I attended were meant to be the release party, but the product just missed the deadline. Now it's here though.

I'm mostly looking forward to the new and improved mapper but the enhanced granularity of performance settings as well as a standard SFTP adapter and integration with AppFabric is nice additions as well. Now I just hope for a project to kick off where this new version is chosen as the platform to use.

Saturday, September 11, 2010

Flat file schemas, delimeter characters, wrap characters and escape characters explained

A question on the BizTalk Professionals group on LinkedIn caused me to write a short answer, but I thought I'd do a more comprehensive take on it here.

The question was: what is the difference between wrap characters and escape characters?

When parsing a flat file schema, delimiter characters are used in order to split the incoming data into separate entities. Let's say we have the following data:

Alpha,Beta,Gamma,Delta,Epsilon

In this case, comma (,) is used as a delimeter which will enable us to split the string into the five separate words we want.

However, if it were to be a list of numbers with decimals and we use comma as the decimal separator as we do in Europe, using comma as a delimeter would be tricky since we don't know whether to split the string on the comma, or use it as a separator. In this case, we can use wrap characters.

"2,25","1,14","5,34"

In this example, the quote character (") is used as a wrap character, i.e. it wraps the separate entities. These are in turn separated with the delimiter character which is a comma (,). This will make us use the delimiter character as part of our data.

The same can be pulled off using escape characters. An escape character is placed before an otherwise reserved character in order to not parse it but to use it as part of the data. Most common is to have backslash (\) as the escape character due to it's use as such in many programming languages.

2\,25,1\,14,5\,34

The above line will give a similar result as the one with wrapped entities if backslash (\) is defined as an escape character. It escapes the following comma (,) which then will not be parsed even if it is defined as the delimiter and so it will be used as part of the data instead.

Friday, September 10, 2010

European BizTalk Conference recap

I'm back at the office after two days at Microsoft in Stockholm and the European BizTalk Conference where I enjoyed myself together with another 150 attendees. A good event as always with the BizTalk User Group Sweden and great sessions that mostly covered the platform around BizTalk for a change.

The three speakers, Richard Seroter, Stephen W. Thomas and Ewan Fairweather, are three of the five authors of the recently published book Applied architecture patterns on the Microsoft platform, which in turn caused the event to follow the basic chapter layout of the book (a book I will review as soon as I have browsed through my copy).

Day one consisted to a large extent of sessions on the different technologies that are available. SQL Server, BizTalk 2010, AppFabric, Azure and WF 4.0 were covered. Day two had sessions covering scenarios where each of the technologies were used in the solution. On this second day, StreamInsight was used in a presentation as well as the last technology presented at the conference. All sessions got taped and so videos should be up on the net within a few weeks I presume.

A very important lesson learned at the conference was a discussion on the anxiety of BizTalk developers considering all this new technology emerging. The speakers made a strong point that BizTalk is not to be replaced by AppFabric, WF 4.0, StreamInsight, SQL Server functionality and whatever there might be. All this new technology can and will instead be used as a complement to BizTalk in order to leverage functionality that previously was hard or impossible to pull off using solely the BizTalk platform. A good example of this was shown in the StreamInsight session with a vast amount of data being streamed and analyzed in realtime.

All in all, a good two days with the crème de la crème of BizTalkers in the region as well as a few from further away in the world.

Thursday, August 12, 2010

"Root element is missing" from a WCF service hosted in BizTalk

When hosting a WCF service in BizTalk, one can come across the error message "Root element is missing" when trying to browse the service metadata.

This error is due to the account running the application pool which in turn is hosting the service in IIS not having access to the BizTalk databases. Make sure that the account has access to the appropriate BizTalk databases, and the service should be fully browsable.

Thursday, August 5, 2010

Visual Studio hangs after debugging

I have repeatedly since I started working in Visual Studio 2008 been swearing while debugging applications since the whole IDE stops responding for a while when stopping the debug session. No updates, service packs or changes to the preferences has been able to stop this behaviour. I've also seen it on numerous other machines and have never been able to figure out why this is happening.

Yesterday I started investigating the issue again and stumbled upon a discussion I've missed before: http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/e9c5da47-a194-4051-a3d5-28b404263b3f

In this discussion, the problem is both found and solutions offered.

The culprit can be many things, but the most common one is that the IDE is trying to contact a server in order to check certificate store validity. If the server can't be reached properly (due to proxies and whatnot), the IDE will hang before timing out.

So, if you have a problem with Visual Studio hanging when stopping a debug, try the following:

First, unplug the network cable (or if you are running wireless, kill the wireless NIC). If this solves the problem, you have an issue with the certificate store. If the IDE still hangs, remove all breakpoints in the code and try again. If there still is a problem, remove the .sou file and retry, this can be corrupt and cause a slowdown.

If you had a snappy IDE with the network cable unplugged, either leave it unplugged, or try one of the following solutions.

Before changing the settings for the certificate store, make sure that all unnecessary protocols are disabled in the network properties. Reports have been made that especially NetWare can interfere. This might solve your problem.

Change the certificate revocation setting in Internet Explorer. Open IE, go to Tools > Internet Options > Advanced > Security > Check for Publisher's Certificate Revocation and uncheck this option. This is a bit unsafe to do though so be aware.

Another solution is to edit the hosts file (\windows\system32\drivers\etc\hosts) to point the URL to your own machine. Add 127.0.0.1 crl.microsoft.com to the file. This is just as unsafe as changing the setting in IE and might end up a change that you forget which can cause grief in the future.


For me, changing the IE settings solved it and I can finally be happy when debugging in Visual Studio.

Tuesday, June 29, 2010

Build using msbuild instead of devenv

I have lately encountered a lot of build scripts that are using devenv. I have a hard time seeing why, now that msbuild is available (and has been for quite a while). Even if you don't want to use the massive amount of possibilities that msbuild brings with it, just swapping out the build part in the scripts can be worth it.

For example, the common line I tend to see is this:
DevEnv /rebuild Release %Solution%

A quick replace to this:
msbuild %Solution% /p:Configuration=Release /T:Rebuild
Will give a 30% speed increase in my cases.
 
If the machine is equipped with several CPU cores (most are), the multicore-switch can give an extra boost:
msbuild %Solution% /p:Configuration=Release /T:Rebuild /m:2

Saturday, June 12, 2010

The expression that you have entered is not valid.

A notorious error message in BizTalk is the irritating "The expression that you have entered is not valid.". This message will be shown in a random fashion when using expression shapes in orchestrations. The message will not make sense since the expression entered in fact is perfectly valid and it will seem impossible to make the message with it's red exclamation mark go away.

I have found two solutions to this problem (not permanent though). One is to simply close and reopen Visual Studio. This will not always work. The other is to comment out the line in question in the expression shape, build the project, and then uncomment the line again.

The reason the message can stick to the project is due to the fact that it is written to the orchestration file itself. This is one of few occasions I've seen error messages be saved to a source file as can be seen in the snippet below:

[Microsoft.XLANGs.BaseTypes.DesignerPosition("3616dac3-6f4f-482a-a3c4-1417e828c572")]
scope longrunning transaction Scope_Trans
{
  body
  {
    #error "The expression that you have entered is not valid."
    [Microsoft.XLANGs.BaseTypes.DesignerPosition("e6cc3fbe-3385-43a2-b535-2a066e76d63c")]
    TSFactory.Framework.Logger.Log(System.Diagnostics.TraceEventType.Information, System.String.Format("{0} Orchestration Start", tracePrefix), logCategory);

By commenting out the line and rebuilding, the error message will also be deleted from the source file and then completely disappear.

Microsoft has released a hotfix for this problem, but I cannot find that it fixed the issue for me, especially in the case of calling external assemblies from an expression shape. Neither did it do any measurable difference for my colleagues. The hotfix can however be found here: http://support.microsoft.com/kb/979153.