2016-10-05 2 views
0

SOAP을 사용하고 있지만 비슷한 문제의 해결책을 찾지 못하는 다음 문제가 발생합니다.
SOAP가 있어야합니다. HTTPS 및 Windows 자격 증명을 통해 호출됩니다.windows autentication을 사용하여 SOAP https를 호출하도록 winform 구성 구성

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <startup> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> 
    </startup> 
    <system.serviceModel> 
    <bindings> 
     <basicHttpsBinding> 
     <binding name="WebServiceSoap"> 
      <security mode="TransportWithMessageCredential"> 
      <transport clientCredentialType="Windows" /> 
      <message clientCredentialType="UserName"/> 
      </security> 
     </binding> 
     </basicHttpsBinding> 
    </bindings> 
    <client> 
     <endpoint address="https://someapp/SDK/WebService.asmx" 
     binding="basicHttpsBinding" bindingConfiguration="WebServiceSoap" 
     contract="someapp_contract.WebServiceSoap" name="WebServiceSoap" /> 
    </client> 
    </system.serviceModel> 
</configuration> 

그리고이 얻을 오류 :

The username is not provided. Specify username in ClientCredentials.And the error 

내가 은 BasicHttpBinding에 너무 differt의 confingruation을 시도 내가 응용 프로그램의 설정에서 할 노력은 무엇

다음 것들 및

<security mode="TransportCredentialOnly"> 
      <transport clientCredentialType="Windows" /> 

하지만 내가 할 수있는 오류가 (매우 논리적 인 오류이다)보다 :

provided URI scheme 'https' is invalid; expected 'http'... 

사람이 과거에 같은 문제가 있었나요를?

미리 감사드립니다.
최대

P.S :
내가 다음 오류 얻을

<security mode="TransportWithMessageCredential"> 

<security mode="Transport"> 

대신 할 경우 : 위의 설정에 따라

The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate,NTLM'. 

답변

0

합니다.
내가 사용하는 경우 :

<security mode="Transport"> 

및 오류 얻을 : 내가 무슨 짓을

The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate,NTLM'. 

다음 변경됩니다.
1) 처음의 app.config

<security mode="Transport"> 
    <transport clientCredentialType="Windows" /> 
    <message clientCredentialType="UserName" algorithmSuite="Default" /> 
</security> 
코드에서보다

에서 :

public static class Ssl 
{ 
    private static readonly string[] TrustedHosts = new[] { 
     "YourServiceName", 
     "YourServiceName2" 
    }; 

    public static void EnableTrustedHosts() 
    { 
     ServicePointManager.ServerCertificateValidationCallback = 
     (sender, certificate, chain, errors) => 
     { 
      if (errors == SslPolicyErrors.None) 
      { 
       return true; 
      } 

      var request = sender as HttpWebRequest; 
      if (request != null) 
      { 
       return TrustedHosts.Contains(request.RequestUri.Host); 
      } 

      return false; 
     }; 
    } 
} 

그리고 :

YourContractInstance.ClientCredentials.Windows.ClientCredential.UserName = ***; 
YourContractInstance.ClientCredentials.Windows.ClientCredential.Domain = ***; 
YourContractInstance.ClientCredentials.Windows.ClientCredential.Password = ***; 
YourContractInstance.ClientCredentials.Windows.AllowNtlm = true; 

좀 문제와 있기 때문에이 해결 방법의 모든되었다 액세스가 허용되지 않는 SOAP 서비스의 호스트에 대한 인증서 구성 | DNS 구성으로 IP로 서비스 참조를 추가해야했습니다.