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 回答