Biztalk WMI hataları

Merhabalar,

Bildiğiniz üzere, Windows Yönetim Araçları (WMI) sınıfları, BizTalk Server yönetiminin yazılımsal olarak gerçekleştirilmesi için kullanılmaktadırlar. Biztalk 2010 sürümü ile gelen WMI sınıfları ile bu doğrultuda .net üzerinde uygulama geliştirilebilmektedir. Aşağıdaki örnekte yeni bir host oluşturmak için kullanılabilecek kod parçacığını görebilirsiniz (Tüm örnek scriptler)  

using System.Management;

...

      public void CreateHost(string HostName, int HostType, string NTGroupName, bool AuthTrusted)   {

         try{

            PutOptions options = new PutOptions();

            options.Type = PutType.CreateOnly;

            //create a ManagementClass object and spawn a ManagementObject instance

            ManagementClass objHostSettingClass = new ManagementClass("root\\MicrosoftBizTalkServer", "MSBTS_HostSetting", null);

            ManagementObject objHostSetting = objHostSettingClass.CreateInstance();

            //set the properties for the Managementobject

            objHostSetting["Name"] = HostName;

            objHostSetting["HostType"] = HostType;

            objHostSetting["NTGroupName"] = NTGroupName;

            objHostSetting["AuthTrusted"] = AuthTrusted;

            //create the Managementobject

            objHostSetting.Put(options);

            System.Console.WriteLine("Host - " + HostName + " - has been created successfully");

         }

         catch(Exception excep)

         {

            System.Console.WriteLine("CreateHost - " + HostName + " - failed: " + excep.Message);

         }

      }

Benzer şekilde Biztalk Yönetim konsolu’da (BTSMMCLauncher.exe) bu sınıfları kullanmaktadır. Biztalk yönetim konsolunda soldaki menü’den ilgili Biztalk Server Grubunu genişlettiğinizde, WMI kaynaklı aşağıdaki gibi bir hata alabilirsiniz (örn. hata kodu: 0x80041010 ):

 "A connection to Windows Management on \\.\ROOT\MicrosoftBizTalkServer cannot be established: Invalid namespace".

Bunun sebebi Biztalk yönetim objelerinin WMI deposunda bulunmamasıdır. Aynı şekilde Event loglara aşağıdaki gibi ‘mmc.exe’ eventları düşebilir.

 

Log Name: Application

Source: .NET Runtime

Date: 7/30/2012 9:31:09 AM

Event ID: 1026

Task Category: None

Level: Error

Keywords: Classic

User: N/A

Application: mmc.exe

Framework Version: v4.0.30319

Description: The process was terminated due to an unhandled exception.

Exception Info: System.Reflection.TargetInvocationException

Stack:

   at Microsoft.ManagementConsole.Executive.MmcThreadMessageWindow.OnThreadException(Exception e)

   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)

   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)

   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)

   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)

   at System.Windows.Forms.Application.Run()

   at Microsoft.ManagementConsole.Internal.SnapInMessagePumpProxy.Microsoft.ManagementConsole.Internal.ISnapInMessagePumpProxy.Run()

   at Microsoft.ManagementConsole.Executive.SnapInThread.OnThreadStart()

   at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)

   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)

   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)

   at System.Threading.ThreadHelper.ThreadStart()

 

Böyle bir durumda aşağıdaki gibi mofcomp.exe komutu ile WMI repository de eksik class , vs. varsa onları tekrar oluşturabiliriz:

 

C:\Windows\System32\wbem>mofcomp "c:\Program Files (x86)\Microsoft BizTalk Server 2010\Bins32\BTSWMISchemaXP.mof"

Microsoft (R) MOF Compiler Version 6.1.7600.16385

Copyright (c) Microsoft Corp. 1997-2006. All rights reserved.

Parsing MOF file: c:\Program Files (x86)\Microsoft BizTalk Server 2010\Bins32\BTSWMISchemaXP.mof

MOF file has been successfully parsed

Storing data in the repository...

Done!

 

‘Managed Object Format’ (MOF) derleyicisi ilgili dosyadaki MOF tanımlarını / sınıflarını derleyecek ve WMI deposuna ekleyecektir.

 

İyi çalışmalar,

Mert Öztürk