是否有办法自动转向管理收到的位置上或通过编码?
-
19-09-2019 - |
题
有没有办法自动执行的开启或关闭的会收到的位置在管?这似乎是应该有某种API或一些这样的对这种事情。我宁愿工作,但WMI或某些种类的剧本会的工作。
解决方案
除了ExplorerOM,因为你已经找到了,你也可以启用/停用收到的地点(和控制发送端口)使用WMI。
我有一个样本PowerShell脚本,显示如何做这些事情 在这里,, 如果你有兴趣。
其他提示
我发现了一个解决方案。看来,Microsoft.BizTalk.ExplorerOM.dll就是我想要的。这是从BizTalk文档,应该让别人开始的摘录:
using System;
using Microsoft.BizTalk.ExplorerOM;
public static void EnumerateOrchestrationArtifacts()
{
// Connect to the local BizTalk Management database
BtsCatalogExplorer catalog = new BtsCatalogExplorer();
catalog.ConnectionString = "Server=.;Initial Catalog=BizTalkMgmtDb;Integrated Security=SSPI;";
// Enumerate all orchestrations and their ports/roles
Console.WriteLine("ORCHESTRATIONS: ");
foreach(BtsAssembly assembly in catalog.Assemblies)
{
foreach(BtsOrchestration orch in assembly.Orchestrations)
{
Console.WriteLine(" Name:{0}\r\n Host:{1}\r\n Status:{2}",
orch.FullName, orch.Host.Name, orch.Status);
// Enumerate ports and operations
foreach(OrchestrationPort port in orch.Ports)
{
Console.WriteLine("\t{0} ({1})",
port.Name, port.PortType.FullName);
foreach(PortTypeOperation operation in port.PortType.Operations)
{
Console.WriteLine("\t\t" + operation.Name);
}
}
// Enumerate used roles
foreach(Role role in orch.UsedRoles)
{
Console.WriteLine("\t{0} ({1})",
role.Name, role.ServiceLinkType);
foreach(EnlistedParty enlistedparty in role.EnlistedParties)
{
Console.WriteLine("\t\t" + enlistedparty.Party.Name);
}
}
// Enumerate implemented roles
foreach(Role role in orch.ImplementedRoles)
{
Console.WriteLine("\t{0} ({1})",
role.Name, role.ServiceLinkType);
}
}
}
}
一个警告,显然此dll不支持64位。因为我只写一个简单的工具,它不是一个大不了我(刚才编译为32位),但它是一个需要注意的。
很高兴见到你似乎已经找到了解决。
想提其也使用Powershell的,ExplorerOM类似的替代,和BizTalk API设置BizTalk项目到各种状态。
接收位置是其中之一。
在脚本接受XML配置文件,您列出的文物,你会喜欢什么样的地位将它们设置为。
在脚本已发布到Microsoft脚本中心: http://gallery.technet.microsoft.com/scriptcenter/Set-Artifact -Status-270f43a0
在响应于Alhambraeidos评论。这里的是代码的一些摘录我在一个Windows应用程序用来禁用接收位置远程:
/// <summary>
/// Gets or sets the biz talk catalog.
/// </summary>
/// <value>The biz talk catalog.</value>
private BtsCatalogExplorer BizTalkCatalog { get; set; }
/// <summary>
/// Initializes the biz talk artifacts.
/// </summary>
private void InitializeBizTalkCatalogExplorer()
{
// Connect to the local BizTalk Management database
BizTalkCatalog = new BtsCatalogExplorer();
BizTalkCatalog.ConnectionString = "server=BiztalkDbServer;database=BizTalkMgmtDb;integrated security=true";
}
/// <summary>
/// Gets the location from biz talk.
/// </summary>
/// <param name="locationName">Name of the location.</param>
/// <returns></returns>
private ReceiveLocation GetLocationFromBizTalk(string locationName)
{
ReceivePortCollection receivePorts = BizTalkCatalog.ReceivePorts;
foreach (ReceivePort port in receivePorts)
{
foreach (ReceiveLocation location in port.ReceiveLocations)
{
if (location.Name == locationName)
{
return location;
}
}
}
throw new ApplicationException("The following receive location could not be found in the BizTalk Database: " + locationName);
}
/// <summary>
/// Turns the off receive location.
/// </summary>
/// <param name="vendorName">Name of the vendor.</param>
public void TurnOffReceiveLocation(string vendorName)
{
ReceiveLocation location = Locations[vendorName].ReceiveLocation;
location.Enable = false;
BizTalkCatalog.SaveChanges();
}
您会发现,有一些我离开了,像我创造收到所谓的“位置”位置的字典,但你应该能明白我的意思。该模式对于要与交互的任何物体的BizTalk非常适用。
不隶属于 StackOverflow