2016-07-11 62 views
0

全部 - 我写了一个dotnet核心API集,在Windows上完美运行。在Ubuntu 14.04上,除了向使用客户端证书进行身份验证的供应商提供的一个SOAP请求外,其他所有功能都可以使用Ubuntu上的Dotnet Core客户端证书

请求总是超时。 Netstat跟踪显示只有1个字节的数据在443被发送到远程服务。没有任何通信发生了100秒,然后应用程序抛出超时异常。

我已经尝试使用openssl导出PEM和CRT文件,并引用除了代码现在配置的方式(pfx w/password)之外的那些。我还将PFX的证书部分加载到ca-certs中。

下面的代码:

 var binding = new BasicHttpBinding(); 
     binding.Security.Mode = BasicHttpSecurityMode.Transport; 
     binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate; 

     var baseAddress = new Uri(mySettings.ClientUrl); 
     factory = new ChannelFactory<SingleSignOnSoap>(binding, new EndpointAddress(baseAddress)); 
     if (RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows) 
     { 
      //windows file location 
      factory.Credentials.ClientCertificate.Certificate = new X509Certificate2(mySettings.PrivateKeyWindowsPath, mySettings.PfxPass); 
     } 
     else 
     { 
      //linux file location 
      factory.Credentials.ClientCertificate.Certificate = new X509Certificate2(mySettings.ClientPrivateKeyUnixPath, mySettings.PfxPass); 

     } 

     serviceProxy = factory.CreateChannel(); 
     RequestTicketRequest request = new RequestTicketRequest(); 
     RequestTicketRequestBody requestBody = new RequestTicketRequestBody(xmlRequest); 
     request.Body = requestBody; 

     RequestTicketResponse response = serviceProxy.RequestTicket(request); 

     return response.Body.RequestTicketResult; 
+0

我没有在代码中包括它,但URL确实使用https:// – mwdavisii

+0

也尝试使用BasicHttpsBinding无济于事 – mwdavisii

回答

0

Wireshark的和tshark的显示认证实际上是工作确定。发生超时是因为ServiceFactory正在等待接收响应,但网络已将连接重置标志([RST,ACK])发送到远程服务器。我已经能够在多个linux发行版上重现,所以我在github上的dotnet核心WCF团队队列中添加了一个问题。