Frage

I tried to setup WCF service with WSHttpBinding and Windows Authentication and HTTP protocol, not HTTPS. Is it possible? I am using IIS 7. Current my config file is below.

With this config application throws exception:

Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding. Registered base address schemes are [].

My code is:

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

    <services>
      <service behaviorConfiguration="WsBehavior" name="LoginService">
        <endpoint address="" binding="wsHttpBinding" bindingConfiguration="WsBinding" contract="ILoginService">
          <identity>
            <dns value="http://localhost:50001/Ws/" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" minFreeMemoryPercentageToActivateService="1">
      <baseAddressPrefixFilters>
        <add prefix="http://localhost:50001/Ws/" />
      </baseAddressPrefixFilters>
    </serviceHostingEnvironment>

    <bindings>
      <wsHttpBinding>
        <binding name="WsBinding" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
  </system.serviceModel>
War es hilfreich?

Lösung

I got next error

The authentication schemes configured on the host ('IntegratedWindowsAuthentication') do not allow those configured on the binding 'WSHttpBinding' ('Anonymous'). Please ensure that the SecurityMode is set to Transport or TransportCredentialOnly. Additionally, this may be resolved by changing the authentication schemes for this application through the IIS management tool, through the ServiceHost.Authentication.AuthenticationSchemes property, in the application configuration file at the element, by updating the ClientCredentialType property on the binding, or by adjusting the AuthenticationScheme property on the HttpTransportBindingElement.

So answer on my question. It's impossible.

Andere Tipps

You need to register a base address in the host/baseAddresses config node. Also, your DNS identity should be a host name and not the endpoint address:

<services> 
  <service behaviorConfiguration="WsBehavior" name="LoginService">
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:50001/Ws"/>
      </baseAddresses>
    </host> 
    <endpoint address="" binding="wsHttpBinding" bindingConfiguration="WsBinding" contract="ILoginService"> 
      <identity> 
        <dns value="localhost" /> 
      </identity> 
    </endpoint> 
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
  </service> 
</services> 
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top