2014-11-10 3 views
0

웹 서비스에서 wsHTTPBinding을 구현하고 싶지만 계속이 오류가 발생합니다. "호출자가 서비스에서 인증되지 않았습니다." 주제에 대한 많은 게시물을 보았지만 내 구성을 수정하지 않거나 내 구성과 관련이 없거나 '대답'이 basicHTTPBinding을 사용하는 것입니다. 서비스는 자체 SSL 인증서가있는 보안 웹 사이트의 루트 폴더에서 호스팅됩니다. 그 인증서를 사용하여 합리적으로 SOAP 메시지를 보호 할 수 있기를 바랬는데 이것이 왜 wsHTTP를 고집하고 싶습니다. 그러나 모든 종류의 구성 수정 시도 - 인증 모드를 'none'으로 설정하는 것만으로도 작동하도록 할 수 있지만 같은 오류가 발생할 때마다. wsHTTPBinding이 기존 SSL 인증서를 사용하여 작동하도록 web.config 설정을 어떻게 수정할 수 있습니까?wsHTTPBinding 인증 오류

의 Web.config

<?xml version="1.0"?> 
    <configuration> 
    <appSettings/> 
     <connectionStrings/> 
     <system.web> 


      <trust level="Full"></trust> 

      <compilation debug="true" strict="false" explicit="true" targetFramework="4.0"/> 

      </system.web> 

      <system.serviceModel> 
      <services> 
       <service behaviorConfiguration="xxxService1.xxx1Behavior" name="xxxService1.xxx1"> 
       <endpoint address="" 
       binding="basicHttpBinding" 
       contract="xxxService1.Ixxx1" 
       bindingConfiguration="secureHttpBinding" 
       > 
       </endpoint> 
       <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
       </service> 
      </services> 
      <bindings> 
     <basicHttpBinding> 
      <binding name="secureHttpBinding"> 
      <security mode="Transport"> 
      <transport clientCredentialType="None"/> 
      </security> 
    </binding> 
    </basicHttpBinding> 
</bindings> 
<behaviors> 
    <serviceBehaviors> 
    <behavior name="xxxService1.Service1Behavior"> 
     <serviceMetadata httpGetEnabled="true"/> 
     <serviceDebug includeExceptionDetailInFaults="false"/> 
    </behavior> 
    <behavior name="xxxService1.xxx1Behavior"> 
     <serviceMetadata httpGetEnabled="true"/> 
     <serviceDebug includeExceptionDetailInFaults="false"/> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"> 
</serviceHostingEnvironment> 
</system.serviceModel> 

<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
</system.webServer> 

</configuration> 

의 App.config

당신은 당신의 클라이언트 및 서버 설정을 게시 할 필요가
<?xml version="1.0" encoding="utf-8" ?> 
    <configuration> 
    <startup useLegacyV2RuntimeActivationPolicy="true"> 

    <requiredRuntime version="v4.0.20506"/> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> 
    </startup> 
    <system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="secureHttpBinding"> 
      <security mode="Transport"> 
      <transport clientCredentialType="None"/> 
      </security> 
     </binding> 
    </basicHttpBinding> 

    </bindings> 
    <client> 

    <endpoint address="https://111.111.111.111/xxxAPI/xxx1.svc" 
      binding="basicHttpBinding" 

      contract="TestingxxxService1.Ixxx1" 
     name="BasicHttpBinding_Ixxx1" 
      bindingConfiguration="secureHttpBinding" /> 
    </client> 
</system.serviceModel> 
</configuration> 

답변

1

. 구성은 인증에 사용해야하는 자격 증명에 따라 다릅니다. HTTP 바인딩 (BasicHttpBinding 또는 WsHttpBinding)을 통해 SSL을 사용하려면 보안 모드가 Transport 또는 TransportWithMessageCredential이됩니다. 왜 이것을 위해 WsHttpBinding이 필요한가요?

여기에 다른 구성 옵션의 무리가 있습니다 http://msdn.microsoft.com/en-us/library/ms789011%28v=vs.110%29.aspx

예 :

<wsHttpBinding> 
    <binding name="WsHttpBinding_ICalculator"> 
     <security mode="TransportWithMessageCredential" > 
      <message clientCredentialType="UserName" /> 
     </security> 
    </binding> 
</wsHttpBinding> 
+0

그래, 네가 맞다면, 나는 이것을 위해 wsHTTP가 필요 없다는 것을 발견했다. 나는 basicHTTP가 SSL을 지원할 것이라고 생각하지 않았다. 편집 한 웹 및 app.config를 게시했지만 이제는 'SSL/TLS 보안 채널에 대한 신뢰 관계를 <웹 사이트의 IP 주소>와 (와)의 권한으로 설정할 수 없습니다.'... –

+0

이것은 자체 인증입니다. 서명 된 인증서? –

+0

CA가 아닙니다. –

0

문제 여기에 우리가 마이그레이션 아직하지 않은 우리의 새로운 사이트에서 서비스를 테스트 한 것이 었습니다 에. 따라서 해당 사이트는 도메인이 아닌 IP 주소로 식별됩니다. 새로운 사이트로 웹 호스팅 서비스 포트에서 기술을 보유한 이전 사이트의 SSL 인증서는 분명히 요청이 인식되지 않은 IP의 리소스에 대한 것이기 때문에 통신을 거부했습니다. 테스트를 위해 기존 사이트로 서비스를 옮겨 문제를 해결했습니다. 이런 식으로 웹 서비스에 액세스하는 경우 IIS에서 SSL 사용을 기억해야합니다. 엔드 포인트 주소 = "https://111.111.111.111/xxxAPI/xxx1.svc"가 될 필요가

: 엔드 포인트 주소 = "https를

나의 config 파일에서 엔드 포인트 요소를 참조하십시오 : //www.mysite.com/xxxAPI/xxx1.svc "