当通过WMI.NET连接到Biztalk Server 2010时,我能够成功地阅读任何数量的类类型,但没有Biztall类。其中每一个都抛出了以下异常措辞:
BizTalk Server cannot access SQL server. This could be due to one of the following reasons:
1. Access permissions have been denied to the current user. Either log on as a user that has been granted permissions to SQL and try again, or grant the current user permission to access SQL Server.
2. The SQL Server does not exist or an invalid database name has been specified. Check the name entered for the SQL Server and database to make sure they are correct as provided during SQL Server installation.
3. The SQL Server exists, but is not currently running. Use the Windows Service Control Manager or SQL Enterprise Manager to start SQL Server, and try again.
4. A SQL database file with the same name as the specified database already exists in the Microsoft SQL Server data folder.
Internal error from OLEDB provider: "Login failed for user 'NT AUTHORITYANONYMOUS LOGON'."
测试代码(无安全信息):
ConnectionOptions options;
options = new ConnectionOptions();
options.Username = @"myusername";
options.Password = @"mypassword";
options.Authority = @"ntlmdomain:mydomain";
ManagementScope scope;
scope = new ManagementScope(@"\BIZSERVERNAMErootMicrosoftBizTalkServer", options);
scope.Connect();
ObjectQuery query = new ObjectQuery("SELECT * FROM MSBTS_Setting");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope,query);
var i = 0;
foreach (ManagementObject key in searcher.Get())
{
listBox1.Items.Add(key.ToString());
i++;
if (i > 100) break;
}
将MSBTS_Setting更改为任何Biztalk类并获得相同的异常。把它改成一个非biztalk类,它就可以很好地运行了。例如:CIM_Setting。
您遇到了所谓的"双跳"问题。(这实际上不是特定于WMI/BT的问题,这也是使用windows身份验证的IIS和Sql Server的常见问题)
当基本上使用"BizTalk WMI"时,会发生这种情况(假设客户端、BT服务器和BT管理数据库位于同一域中,但位于不同的计算机上):
客户端凭据被发送到BT服务器/WMI提供商。BT服务器应该将凭据传输到Sql服务器,但kerberos(默认情况下)不允许这样做。
另请参阅此技术网文章:
- 为什么我的远程操作涉及第三台机器时会失败
- 了解Kerberos双跃点
基本上,您有3个使用"BT-WMI"的选项:
- 在BT主机上使用WMI运行代码,这只需要单跳到sql server。或者通过BT主机上托管的web服务公开必要的功能
- 使用Microsoft.BizTalk.ExplorerOM组件
- 为帐户和BT主机启用委派(在Active Directory中):允许信任计算机来委派特定服务
我认为这可能是因为用于访问WMI对象的帐户不是"SSO管理员"组的成员。
我遇到了一个非常类似的问题(BizTalk WMI访问问题),并看到了这篇文章。将帐户添加到"SSO管理员"组对我很有效。