我们开发了一个系统,其中客户端应用程序是使用 Web 服务与服务器通信的 .NET 客户端。我们需要能够使用不同的配置选项来部署客户端,例如 IP 地址等。到目前为止,我们基本上通过在 app.config 中注释/取消注释不同的配置来管理它,例如:
<!--<client>
<endpoint address="https://localhost/services/service1"
binding="customBinding" bindingConfiguration="ServiceSoapBinding"
contract="ServiceReference.Service1" name="ServiceImplPort" />
<endpoint address="https://localhost/services/service2"
binding="customBinding" bindingConfiguration="ServiceSoapBinding"
contract="ServiceReference.Service2" name="ServiceImplPort" />
...
..
</client>-->
<client>
<endpoint address="https://prod.example.com/services/service1"
binding="customBinding" bindingConfiguration="ServiceSoapBinding"
contract="ServiceReference.Service1" name="ServiceImplPort" />
<endpoint address="https://prod.example.com/services/service2"
binding="customBinding" bindingConfiguration="ServiceSoapBinding"
contract="ServiceReference.Service2" name="ServiceImplPort" />
...
..
</client>
Run Code Online (Sandbox Code Playgroud)
但很明显,这不是问题的最佳解决方案,随着配置备选方案数量的增加,它变得有点难以管理。任何如何改进这一点的建议都是最受欢迎的。
问候,奥拉
我试图在 Java bean 的主体上设置一个属性,该属性构成通过 Camel 路由传输的消息。我尝试了各种方法,例如
<route>
...
..
<transform>
<simple>${body.label} = ${property.label}</simple>
</transform>
...
..
</route>
Run Code Online (Sandbox Code Playgroud)
在这种特殊情况下,它${body}是一个带有setLabel(String label)方法的 Java bean,它${property.label}是通过其他方式在另一个路由中设置的。在这个例子中,结果不是想要的(我明白为什么),即在转换之后,消息的正文被替换为${body.label} = ${property.label}字符串。
我目前的解决方法是将转换器手动编码为 Spring bean 并在代码中设置 Java bean 的标签属性,但我想找出是否有更简单/更智能的方法来实现这一点,最好是在 XML DSL 中我用什么?
问候,奥拉
我正在尝试从Exchange连接的Outlook中读出Internet格式的地址.我从Outlook联系人中读取了所有联系人,即不是来自全球通讯簿(GAB),问题是对于从Exchange GAB存储在联系人中的所有用户,我只是设法读出X.500格式在这种情况下无用的地址.对于不在Exchange服务器域中的所有手动添加的联系人,将按预期导出Internet地址.
基本上我使用以下代码片段来枚举联系人:
static void Main(string[] args)
{
var outlookApplication = new Application();
NameSpace mapiNamespace = outlookApplication.GetNamespace("MAPI");
MAPIFolder contacts = mapiNamespace.GetDefaultFolder(OlDefaultFolders.olFolderContacts);
for (int i = 1; i < contacts.Items.Count + 1; i++)
{
try
{
ContactItem contact = (ContactItem)contacts.Items[i];
Console.WriteLine(contact.FullName);
Console.WriteLine(contact.Email1Address);
Console.WriteLine(contact.Email2Address);
Console.WriteLine(contact.Email3Address);
Console.WriteLine();
}
catch (System.Exception e) { }
}
Console.Read();
}
Run Code Online (Sandbox Code Playgroud)
有没有办法提取Internet地址而不是X.500?
我正在开发一个Ansible playbook,我用它ec2_vpc_subnet_facts在VPC中注册有关子网的事实,如:
- ec2_vpc_subnet_facts:
region: "{{ ec2_region }}"
filters:
vpc-id: "{{ vpc.vpc.id }}"
register: vpc_subnet_facts
Run Code Online (Sandbox Code Playgroud)
从而得到一个像(删除不相关的属性)的结构:
"vpc_subnet_facts": {
"changed": false,
"subnets": [
{
...
"id": "subnet-0bb50753",
...
"tags": {
"Name": "mytag1"
},
...
},
{
...
"id": "subnet-0bb50754",
...
"tags": {
"Name": "mytag2"
},
...
}
]
}
Run Code Online (Sandbox Code Playgroud)
稍后在剧本中,当创建EC2实例时,想法是基于ec2模块vpc_subnet_id属性的标签值查找子网ID ,即mytag1查找关联的子网ID subnet-0bb50753.
我目前的方法是tag => subnet-ID使用结果创建一个字典set_facts,ec2_vpc_subnet_facts但我对替代品感兴趣.
问候,奥拉
amazon-ec2 amazon-web-services amazon-vpc ansible ansible-playbook