简体   繁体   中英

WCF Binding set to wsHttpBinding using browser to access Web Service has it as basicHttpBinding

Wrote up a web service starting with BasicHttpBinding for simple development of the service without having to worry about security. In moving it to the web server I switched the binding to WsHttpBinding along with Basic Authentication like another web service on the web server. However when I browse to the web service to validate it's running it's saying that the configured binding is still BasicHttpBinding. Verified IIS is pointing to the correct location.

The authentication schemes configured on the host ('Basic') do not allow those configured on the binding 'BasicHttpBinding' ('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.

Web.config

<configuration>
   <appSettings>
   </appSettings>
   <system.web>
      <compilation debug="true" targetFramework="4.0" />
    </system.web>
    <system.serviceModel>
      <bindings>
        <wsHttpBinding>
          <binding name="MyBinder">
            <security mode="Transport">
               <transport clientCredentialType="Basic"></transport>
            </security>
         </binding>
       </wsHttpBinding>
     </bindings>
     <services>
      <service name="MyService">
         <endpoint address=""
                binding="wsHttpBinding"
                bindingConfiguration="MyBinder"
                name="MyEndpoint"
                contract="MyService.IMyInterface"></endpoint>
      </service>
     </services>
     <behaviors>
        <serviceBehaviors>
            <behavior name="">
                <serviceMetadata httpsGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
</configuration> 

Solved it. Removed the ServiceHostingEnviorment tag at the bottom and noticed that it was using WsHttpBinding then have to have my service name match the namespace.class of the service. Once this was set everything worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM