1

iis サーバーで wcf Web サービスを公開し、Windows 認証を使用しようとしています。公開しようとしてもエラーが発生するため、ユーザー名の入力を求めるプロンプトが表示されるまでには十分に進んでいません。私は SSL 証明書を持っており、ssl を使用したいと考えています。

これは私のエラーです:

[InvalidOperationException: Could not find a base address that matches scheme http for the endpoint with binding BasicHttpBinding. Registered base address schemes are [https].]
   System.ServiceModel.ServiceHostBase.MakeAbsoluteUri(Uri relativeOrAbsoluteUri, Binding binding, UriSchemeKeyedCollection baseAddresses) +16604769
   System.ServiceModel.Description.ConfigLoader.LoadServiceDescription(ServiceHostBase host, ServiceDescription description, ServiceElement serviceElement, Action`1 addBaseAddress) +1082
   System.ServiceModel.ServiceHostBase.ApplyConfiguration() +156
   System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses) +215
   System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses) +475
   System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses) +43
   System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +530
   System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +1413
   System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +50
   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +1172

[ServiceActivationException: The service '/subservice/ISubService.svc' cannot be activated due to an exception during compilation.  The exception message is: Could not find a base address that matches scheme http for the endpoint with binding BasicHttpBinding. Registered base address schemes are [https]..]
   System.Runtime.AsyncResult.End(IAsyncResult result) +901424
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +178638
   System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +136

これについて何百回も調査しましたが、サービスを公開した経験はほとんどありません。彼らが構築された後、私は彼らと協力してきました.

これは、問題なく公開されている別の web.config から変更した私の web.config です。

<?xml version="1.0"?>

<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <system.serviceModel>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpEndpointBinding">
          <security mode="Transport">
            <!-- Basic <security mode="Transport"> -->
            <!-- To use Basic auth, just comment Windows and use this, but you need to configure basic in IIS as well -->
            <!-- <transport clientCredentialType="Basic" /> -->
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </basicHttpBinding>

      <webHttpBinding>
        <binding name="default">
          <security mode="Transport">
            <!-- Basic <security mode="Transport"> -->
            <!-- To use Basic auth, just comment Windows and use this -->
            <!-- <transport clientCredentialType="Basic" /> -->
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </webHttpBinding>
    </bindings>

    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpsGetEnabled="true" />
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="restBehavior">          
          <webHttp />
        </behavior>
      </endpointBehaviors>      
    </behaviors>

    <services>
      <service name="subservice.ISubService">
        <endpoint binding="basicHttpBinding"  bindingConfiguration="BasicHttpEndpointBinding" contract="subservice.ISubService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>

        <endpoint address="rest" binding="webHttpsBinding" bindingConfiguration="default" behaviorConfiguration="restBehavior" contract="subservice.ISubService">
          <identity>
            <dns value="localhost" />                       
          </identity>
        </endpoint>

        <host>
          <baseAddresses>
            <add baseAddress = "https://[site]/subservice/" />
          </baseAddresses>
        </host>

      </service>

    </services>
  </system.serviceModel>
</configuration>

誰かが私が間違っていることを見ていますか?

4

1 に答える 1

2

basicHttpBindingを使用する代わりに、basicHttpsBindingを使用します

http://msdn.microsoft.com/en-us/library/system.servicemodel.basichttpsbinding.aspx

于 2013-02-11T07:48:56.620 に答える