Archive for July, 2008

Cannot add Microsoft XML v6.0 “msxml6.dll” as COM reference in Visual Studio 2008

July 23, 2008

Why Can Fail?!

When adding Microsoft XML v6.0 “msxml6.dll”  as COM reference to my project in Visual Studio 2008. Visual Studio shows a yellow “!” exclamation mark and an error saying “The system cannot find the file specified” even though I tried to

1. Add through COM references
2. Directly point to the file in my “system32” folder
3. Copying the file to my local bin directory and adding the reference there.

I have Microsoft XML versions 2.6, 3.0, 5.0 and 6.0 installed and only v6.0 seems to exhibit this issue. Searched the net for more information but was so for was unable to find any related information regarding this issue.

Why Like That?!

After much frustration, finally found the answer in the registry. Looked for

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{F5078F18-C551-11D3-89B9-0000F81FE221}\6.0

Which was the GUID for MSXML v6.0

There were 2 value under this entry.

“PrimaryInteropAssemblyName”=”Microsoft.SqlServer.msxml6_interop, Version=6.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91”

“PrimaryInteropAssemblyCodeBase”=”D:\\Program Files\\Microsoft SQL Server\\90\\DTS\\Microsoft.SqlServer.msxml6_interop.dll”

It mentions that the Primary Interop Assembly for MSXML6 is already created and it is stored under

“D:\Program Files\Microsoft SQL Server\90\DTS\Microsoft.SqlServer.msxml6_interop.dll”

HOWEVER, the dll is actually stored in

D:\Program Files\Microsoft SQL Server\90\DTS\Binn\ Microsoft.SqlServer.msxml6_interop.dll

So (I am assuming) when VS 2008 tries to add the reference, it skips the compilation by tlbImp.exe since a primary Interop assembly is already registered, tries to look for it in the folder specified in the registry, but fails because it is not there.

I was able to replicate this on my colleague’s machines, so this seems to be a scripting error in SQL 2005 Server installer.  /facepalm

What To Do?!

So, to resolve this issue, you can either

a) correct the path in the registry  to the actual location

“D:\Program Files\Microsoft SQL Server\90\DTS\Binn\ Microsoft.SqlServer.msxml6_interop.dll”

or

b) delete the entry in the registry to force a recompilation every time the reference is added.

Cheers.

Advertisements

Error: The target principal name is incorrect

July 17, 2008

Why Can Fail?!

After <security mode=”Transport”> is set, when my web application tries to call my WCF service, which is residing on a different server, this error pops up.

“The target principal name is incorrect.”

( >_< )

Why Like That?!

Apparently this issue has to do with Kerberos authenication, NTLM, SPN and all those stuff. (welcome any others to give a more accurate definition of “all those stuff”) If the client and service reside on the same server, all works fine as it is using NTLM. On separate servers, Kerberos authenication is used, which fails.

What To Do?!

A workaround is to insert a dummy identity element into the endpoint section of the client config.

<endpoint name=””
address=”
http://localhost:8000/servicemodelsamples/service
binding=”wsHttpBinding”
bindingConfiguration=”Binding1″
contract=”ICalculator” >

<identity>
<servicePrincipalName value=”MYSERVICE/MyMachine”/>
</identity>

</endpoint>
</client>

Ironically, what this does is to force the service to fall back to NTLM authentication after Kerberos authentication using the dummy identity element fails. The service does not fall back to NTLM authentication without a identity element, don’t ask me why…. ( @_@; )

A more concrete solution seems to define the ServicePrincipalName for the assigned username or run the service (or client) under higher privileges. Both of these solutions has yet to be tested. To be investigated further if time permits.

Where Got Clue?!

I got the information from these 2 forum posts.

http://www.bokebb.com/dev/english/2047/posts/204720629.shtml

http://www.bokebb.com/dev/english/2047/posts/204721253.shtml