在我的一个对话框中,我有以下控件:
<Control Id="EnvironmentComboBox" Type="ComboBox" Sorted="yes" ComboList="yes" Property="ENVIRONMENT" X="25" Y="110" Width="200" Height="15" />
Run Code Online (Sandbox Code Playgroud)
我在其他地方填写ComboBox如下:
<UI>
<ComboBox Property="ENVIRONMENT">
<ListItem Text="Development" Value="Development" />
<ListItem Text="SIT" Value="SIT" />
<ListItem Text="UAT" Value="UAT" />
<ListItem Text="Production" Value="Production" />
</ComboBox>
</UI>
Run Code Online (Sandbox Code Playgroud)
但是,如果我没有创建ComboBox位,MSI仍将构建,并且在安装期间它将失败(2205).因此,我想强制要求拥有一个名为ENVIRONMENT的属性.我试过在我的对话框中添加如下所示的PropertyRef:
<PropertyRef Id="ENVIRONMENT" />
Run Code Online (Sandbox Code Playgroud)
但是,这似乎没有好转<ComboBox Proeprty="ENVIRONMENT">.它将获取一个常规属性(<Property Id="ENVIRONMENT" Value="test" />),但这并没有多大帮助.
有没有办法要求ComboBox定义?
编辑: 为了澄清,我打算将ComboBox定义与Control定义分开,以便可以重用该对话框.
我有一个使用Message安全性的负载均衡服务:
<wsHttpBinding>
<binding>
<security mode="Message">
<message clientCredentialType="Windows" establishSecurityContext="false" />
</security>
</binding>
</wsHttpBinding>
Run Code Online (Sandbox Code Playgroud)
我对此服务的所有调用都会打开和关闭自己的通道,因此建立安全上下文没有任何好处.
我正在使用WSHttpBinding与服务配置匹配的服务来调用服务:
ws.Security.Mode = SecurityMode.Message;
ws.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
ws.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
ws.Security.Message.EstablishSecurityContext = false;
Run Code Online (Sandbox Code Playgroud)
这有时会起作用,但有时我会遇到诸如此类的错误
安全上下文令牌已过期或无效.邮件未处理.
要么
安全令牌请求包含无效或格式错误的元素.
我终于发现将EstablishSecurityContext设置为false实际上并不会阻止使用安全上下文令牌.我们的负载均衡器目前不使用粘性会话,我试图避免走这条路.
我确实发现我应该能够在客户端上将NegotiateServiceCredential设置为false,以允许没有粘性会话的负载均衡器.我的服务已在AD帐户下运行,我可以在WSDL中看到它:
<Upn>User@Domain</Upn>
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试将服务标识添加到我的客户端时
EndpointIDentity.CreateUpnIdentity("User@Domain")
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
不支持对在需要Kerberos多重标记的用户帐户下运行的服务进行身份验证.
如何通过负载均衡器调用我的服务?
我的 Windows 主机支持 PHP,但 PHP 未配置为支持 ODBC 或 MSSQL。我无法让他们改变它,所以我想知道是否有办法通过其他方式连接到 SQL Server - 也许包括一些提供我需要的功能的文件?
是否可以为使用Thread类创建的线程提供回调(宣布完成活动).我已经按照以下方式创建了该线程,但无法找到给出回调的方法.
Thread thread = new Thread(StartPoll);
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
Run Code Online (Sandbox Code Playgroud) 我有一个SAML断言的XML,如下所示:
<saml:Assertion MajorVersion="1" MinorVersion="1" AssertionID="_9b6e6302-d6a8-47f0-9155-1051a05edbfb" Issuer="http://example.com/adfs/services/trust" IssueInstant="2013-04-29T19:35:51.197Z" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion">
...
</saml:Assertion>
Run Code Online (Sandbox Code Playgroud)
我试图使用类似于以下代码从这个XML中获取SecurityToken:
// Loading the XML referenced above.
XDocument doc = XDocument.Load(new StringReader(assertion));
// Creating config to use in TokenHandlers below; required if not using a SecurityTokenHandlerCollection.
SecurityTokenHandlerConfiguration config = new SecurityTokenHandlerConfiguration();
config.AudienceRestriction.AllowedAudienceUris.Add(new Uri("https://localhost/Orchard/"));
config.CertificateValidator = X509CertificateValidator.None;
// Both of these lines throw Exceptions, as explained below.
new Saml11SecurityTokenHandler() { Configuration = config }.ReadToken(doc.CreateReader());
new Saml2SecurityTokenHandler() { Configuration = config }.ReadToken(doc.CreateReader());
Run Code Online (Sandbox Code Playgroud)
如果我尝试使用它读取令牌Saml11SecurityTokenHandler,我会得到以下异常:
ID4075:SAML断言缺少必需的"MajorVersion"属性.
如果我尝试使用它读取令牌Saml2SecurityTokenHandler,我会得到一个不同的例外:
没有找到名称空间名称为'urn:oasis:names:tc:SAML:2.0:assertion'的Element'Assertion'.
显然Saml2SecurityTokenHandler …
我有2个集合都包含相同类型的对象,并且两个集合每个都有大约40K对象.
每个集合包含的对象的代码基本上就像一个字典,除了我重写了equals和hash函数:
public class MyClass: IEquatable<MyClass>
{
public int ID { get; set; }
public string Name { get; set; }
public override bool Equals(object obj)
{
return obj is MyClass && this.Equals((MyClass)obj);
}
public bool Equals(MyClass ot)
{
if (ReferenceEquals(this, ot))
{
return true;
}
return
ot.ID.Equals(this.ID) &&
string.Equals(ot.Name, this.Name, StringComparison.OrdinalIgnoreCase);
}
public override int GetHashCode()
{
unchecked
{
int result = this.ID.GetHashCode();
result = (result * 397) ^ this.Name.GetSafeHashCode();
return result;
}
}
}
Run Code Online (Sandbox Code Playgroud)
我用来比较集合并获得差异的代码只是使用PLinq的简单Linq查询.
ParallelQuery p1Coll = …Run Code Online (Sandbox Code Playgroud) 通常情况下,你可以得到的服务实例从OperationContext这样的:
OperationContext.Current.InstanceContext.GetServiceInstance()
Run Code Online (Sandbox Code Playgroud)
但是,当你在一个时IAuthorizationPolicy,InstanceContext是null.在IIS中托管时,是否有其他方法可以获取服务实例?
假设我有一个名为 A 的用户控件,它执行以下操作:
Page_Load:
List<object> myList = PrepareList();
ListPrepared(this, new AArgs(myList)); // Event that lets subscribers modify the list.
OperateOnAndDisplayList(myList);
Run Code Online (Sandbox Code Playgroud)
A 的实例保存在订阅 ListPrepared 事件并修改创建的列表的页面中。显然,我希望页面的处理程序在操作和显示列表之前完成,因为它正在修改列表以确保完整性。我将如何实施这个?(或者这是一个可怕的想法,因为它公开了列表,因此需要外部元素了解列表才能修改它?)