小编Dud*_*udi的帖子

客户端身份验证方案"Anonymous"禁止HTTP请求

我正在尝试配置WCF服务器\客户端以使用SSL

我得到以下异常:

客户端身份验证方案"Anonymous"禁止HTTP请求

我有一个自托管的WCF服务器.我运行hhtpcfg我的客户端和服务器证书都存储在本地计算机上的个人和受信任人员下

这是服务器代码:

binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
binding.Security.Mode = WebHttpSecurityMode.Transport;
_host.Credentials.ClientCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.PeerOrChainTrust;
_host.Credentials.ClientCertificate.Authentication.RevocationMode = X509RevocationMode.NoCheck;
_host.Credentials.ClientCertificate.Authentication.TrustedStoreLocation = StoreLocation.LocalMachine;
_host.Credentials.ServiceCertificate.SetCertificate("cn=ServerSide", StoreLocation.LocalMachine, StoreName.My);
Run Code Online (Sandbox Code Playgroud)

客户代码:

binding.Security.Mode = WebHttpSecurityMode.Transport;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate; 
WebChannelFactory<ITestClientForServer> cf =
                new WebChannelFactory<ITestClientForServer>(binding, url2Bind);
cf.Credentials.ClientCertificate.SetCertificate("cn=ClientSide", StoreLocation.LocalMachine, StoreName.My);
            ServicePointManager.ServerCertificateValidationCallback
                   += RemoteCertificateValidate;
Run Code Online (Sandbox Code Playgroud)

查看web_tracelog.svclog和trace.log显示服务器无法验证客户端证书我的证书未由授权CA签名,但这就是我将它们添加到可信人员的原因....

我错过了什么?我错过了什么?

security https wcf certificate

15
推荐指数
1
解决办法
4万
查看次数

shape.Parent不返回幻灯片

在大多数情况下shape.Parent,幻灯片包含形状.

但是,如果您尝试删除一个组,然后按下撤消(形状将重新出现),但子形状将为两个.Parent和组件抛出异常.ParentGroup.

如何在上面的案例中找到形状的幻灯片ID?

powerpoint powerpoint-vba

5
推荐指数
1
解决办法
743
查看次数

如何通过具有不同状态代码的 Nock 对同一 url 进行后续调用

问题:我想模拟在同一个 http 调用中得到不同结果的情况。具体来说,第一次失败。在某种程度上,这类似于Sinon 的能力stub.onFirstCall()stub.onSecondCall() 期望:我预计如果我once在第一次调用和twice第二次调用时使用,我将能够完成上述操作。

nock( some_url )
    .post( '/aaaa', bodyFn )
    .once()
    .reply( 500, resp );
nock( some_url )
    .post( '/aaaa', bodyFn )
    .twice()
    .reply( 200, resp );
Run Code Online (Sandbox Code Playgroud)

node.js sinon nock

4
推荐指数
1
解决办法
3446
查看次数

Java Arrays.hashcode()奇怪的行为

我有一个对象有一个字段 - double [] _myField它的hashcode是

public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + Arrays.hashCode(_myField);
    return result;
}
Run Code Online (Sandbox Code Playgroud)

但是,如果我将对象用作Map中的键,我会得到以下奇怪的行为:

for (Map.Entry<MyObject, String> entry: _myMap.entrySet())
    {
         if (entry.getValue() != _myMap.get(entry.getKey()))
         {
                 System.out.println("found the problem the value is null");

         }

    }
Run Code Online (Sandbox Code Playgroud)

我能想到上述IF语句为真的唯一原因是我得到了一个不同的密钥哈希码.

事实上,我已经改变了哈希码函数,在所有情况下都返回1.效率不高,但有利于调试,实际上IF语句总是错误的.

Arrays.hashcode()有什么问题?

请注意(在阅读一些注释后):1)至于在IF语句中使用!=,它确实比较了引用,但在上面的情况下它应该是相同的.无论如何奇怪的是右手边返回NULL 2)至于发布Equals功能.当然我已经实现了它.但这无关紧要.在调试中跟踪代码表明只调用了哈希码.原因可能是奇怪的是,返回的哈希码与原始哈希码不同.在这种情况下,Map找不到匹配的条目,因此不需要调用Equals.

java arrays hashcode

0
推荐指数
1
解决办法
868
查看次数