如何做文件夹以要求IIS提供SSL证书

时间:2018-06-22 11:52:45

标签: web-services iis ssl-certificate

我必须在Visual Studio 2015 MVC中提供WCF服务,并且该服务只能通过SSL证书访问,我正在使用IIS(在Windows10中),并且尝试限制仅对此服务的SSL(存储在特定文件夹中) )。

当我将此文件夹的IIS选项更改为“ require SSL”时,服务会说“ http请求未经客户端身份验证方案'anonymous'的授权”

我也更改了web.config,也许那里有些问题,服务的名称是EncServiceSSL

我该怎么办?

WEB.config:

<system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>

        <behavior name="ServiceCredentialsBehavior">
          <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
             <serviceAuthorization serviceAuthorizationManagerType="MyNamespace.ClientCertificateValidator, MyAssembly">
            <authorizationPolicies>
              <add policyType="MyNamespace.AdamAuthorizationPolicy, MyAssembly" />
            </authorizationPolicies>
            </serviceAuthorization>
          <serviceCredentials>
            <serviceCertificate findValue="1234xx" x509FindType="FindBySubjectName"   storeLocation="LocalMachine"  storeName="Root"/>
               <clientCertificate>
                   <authentication certificateValidationMode="PeerTrust"  trustedStoreLocation="LocalMachine" />
            </clientCertificate>
          </serviceCredentials>  
           <useRequestHeadersForMetadataAddress>
        <defaultPorts>
          <add scheme="https" port="443"/>
        </defaultPorts>
      </useRequestHeadersForMetadataAddress>
        </behavior>



      </serviceBehaviors>
    </behaviors>
    <services>
      <service behaviorConfiguration="ServiceCredentialsBehavior"  name="System.Web.ApplicationServices.AuthenticationService">
        <endpoint address="http://localhost:8111/ServicesSSL/EncServiceSSL"
                  binding="wsHttpBinding"
                  bindingConfiguration="QuoteService"
                  name="SecuredByClientCertificate"
                  contract="encelogistica.QuoteServiceReference.QuoteServiceSoapChannel" />
      </service>
    </services>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <bindings>
      <basicHttpBinding>

        <binding name="QuoteService">         
          <security mode="Transport">               
                   <transport clientCredentialType="Windows" />            
          </security>
        </binding>
        <binding name="QuoteServiceSoap" />
      </basicHttpBinding>  
    </bindings>  
    <client>

      <endpoint address="http://localhost:8111/ServicesSSL/EncServiceSSL.asmx"
        binding="basicHttpBinding" bindingConfiguration="QuoteServiceSoap"
        contract="QuoteServiceReference.QuoteServiceSoap" name="QuoteServiceSoap" />
    </client>
  </system.serviceModel>
</configuration>

0 个答案:

没有答案