2012-04-09 2 views
1

통신에 https를 사용하고 응답 형식에 json을 사용하는 WCF 서비스가 있습니다. 누구든지 사용할 수있는 방법을 원하지 않기 때문에 IIS의 인증을 익명의 &에서 기본으로 변경하면됩니다. https를 통한 WCF 인증

지금까지, 브라우저는 사용자 요청 및 통과 그러나 나는 다음과 같은 오류가 있습니다 :

WebHttpBinding이라는 바인딩에 엔드 포인트에 대한 스키마 http을 일치하는 기본 주소를 찾을 수 없습니다. 등록 된 기본 주소 체계는 [https]입니다.

인증 작업에 종단점을 변경해야하는 이유는 무엇입니까?

<?xml version="1.0"?> 
<configuration> 
    <system.web> 
    <compilation debug="false" targetFramework="4.0" /> 
    </system.web> 
    <system.serviceModel> 
    <bindings> 
     <webHttpBinding> 
     <binding name="restBinding"> 
      <security mode="TransportCredentialOnly"> 
      <transport clientCredentialType="Basic" proxyCredentialType="Basic" /> 
      </security> 
     </binding> 
     </webHttpBinding> 
    </bindings> 
    <services> 
     <service name="ContactLibrarySecure.ContactLibraryService"> 
     <endpoint address="mex" binding="mexHttpsBinding" bindingConfiguration="" 
      name="mex" contract="IMetadataExchange" /> 
     <endpoint address="rest" behaviorConfiguration="restBehavior" 
      binding="webHttpBinding" bindingConfiguration="restBinding" 
      name="rest" contract="ContactLibrarySecure.IContact" /> 
     <host> 
      <baseAddresses> 
      <add baseAddress="https://192.168.1.31/ContactLibrary2.0HTTPS" /> 
      </baseAddresses> 
     </host> 
     </service> 
    </services> 
    <behaviors> 
     <endpointBehaviors> 
     <behavior name="restBehavior"> 
      <webHttp /> 
     </behavior> 
     </endpointBehaviors> 
     <serviceBehaviors> 
     <behavior name=""> 
      <serviceMetadata httpsGetEnabled="true" /> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
    <system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 

</configuration> 

답변

1
<?xml version="1.0"?> 
<configuration> 
    <system.web> 
    <compilation debug="false" targetFramework="4.0" /> 
    </system.web> 
    <system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="soapBinding" maxBufferSize="2000000000" maxBufferPoolSize="2000000000" 
      maxReceivedMessageSize="2000000000"> 
      <security mode="Transport"> 
      <transport clientCredentialType="Windows" proxyCredentialType="Basic" /> 
      <message clientCredentialType="UserName" /> 
      </security> 
     </binding> 
     </basicHttpBinding> 
     <wsHttpBinding> 
     <binding name="mexBinding"> 
      <security mode="Transport"> 
      <transport clientCredentialType="Windows" /> 
      <message clientCredentialType="UserName" /> 
      </security> 
     </binding> 
     </wsHttpBinding> 
     <webHttpBinding> 
     <binding name="restBinding" closeTimeout="00:10:00" sendTimeout="00:10:00" 
      maxBufferSize="2000000000" maxBufferPoolSize="2000000000" maxReceivedMessageSize="2000000000"> 
      <security mode="Transport"> 
      <transport clientCredentialType="Windows" /> 
      </security> 
     </binding> 
     </webHttpBinding> 
    </bindings> 
    <services> 
     <service name="ContactLibrarySecure.ContactLibraryService"> 
     <endpoint address="mex" binding="wsHttpBinding" bindingConfiguration="mexBinding" 
      name="mex" contract="IMetadataExchange" /> 
     <endpoint address="rest" behaviorConfiguration="restBehavior" 
      binding="webHttpBinding" bindingConfiguration="restBinding" 
      name="rest" contract="ContactLibrarySecure.IContact" /> 
     <endpoint address="soap" behaviorConfiguration="soapBehavior" 
      binding="basicHttpBinding" bindingConfiguration="soapBinding" 
      name="soap" contract="ContactLibrarySecure.IContact" /> 
     <host> 
      <baseAddresses> 
      <add baseAddress="https://192.168.1.31/ContactLibrary2.0HTTPS" /> 
      </baseAddresses> 
     </host> 
     </service> 
    </services> 
    <behaviors> 
     <endpointBehaviors> 
     <behavior name="restBehavior"> 
      <webHttp /> 
      <dataContractSerializer maxItemsInObjectGraph="2147483647" /> 
     </behavior> 
     <behavior name="soapBehavior"> 
      <dataContractSerializer maxItemsInObjectGraph="2147483647" /> 
     </behavior> 
     </endpointBehaviors> 
     <serviceBehaviors> 
     <behavior name=""> 
      <serviceMetadata httpsGetEnabled="true" /> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
    <system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 

</configuration> 

이 설정 파일 내 문제를 해결 :

내 Web.config의는 것 같습니다. iis에서 Windows 인증을 설치 한 후 기본 인증에서 Windows 인증으로 변경되었습니다.