Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WCF Web Service and SSL

Status
Not open for further replies.

PGO01

Programmer
Jan 8, 2008
156
GB
I have a wcf web service with SSL that I am testing on my local development machine. I have an SSL certificate installed on my local machine.

I keep getting this error:

The HTTP request is unauthorized with client authentication scheme 'Basic'. The authentication header received from the server was 'Negotiate,NTLM,Basic Realm'.The remote server returned an error: (401) Unauthorized.

Here is the binding and service part of my service web.config file:
Code:
<binding name="BasicBindingConfiguration">
  <readerQuotas maxArrayLength="2000000" maxStringContentLength="2000000"/>
  <security mode="Transport" />
</binding>

<service 
  behaviorConfiguration="XXXService.Service1Behavior"
  name="XXXService.Service1">
  <endpoint 
    address="" 
    binding="basicHttpBinding" 
    bindingConfiguration="BasicBindingConfiguration"
    name="basicEndpoint" 
    contract="XXXService.IService1" />
  <endpoint 
    address="mex" 
    binding="mexHttpsBinding" 
    bindingConfiguration=""
    name="MexEndpoint" 
    contract="IMetadataExchange" />
</service>
And here is configuration section of the app.config in my test windows forms application:
Code:
<system.serviceModel>
  <bindings>
    <basicHttpBinding>
      <binding 
        name="basicEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" 
        sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
        maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" 
        textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        <security mode="Transport"> 
          <transport clientCredentialType="Basic" proxyCredentialType="None" realm="" />
          <message clientCredentialType="UserName" algorithmSuite="Default" />
        </security>
      </binding>
    </basicHttpBinding>
  </bindings>
  <client>
    <endpoint 
      name="basicEndpoint"
      address="[URL unfurl="true"]https://localhost/XXXService/Service1.svc"[/URL]
      binding="basicHttpBinding" 
      bindingConfiguration="basicEndpoint"
      contract="XXXService.IService1" />
  </client>
</system.serviceModel>

Can anyone help with the error I am getting?

Many thanks,
 
Well I got it to work, not sure if it is correct though. I changed the security settings of the service in IIS to have Anonymous login enabled and Windows Authentication disabled.

Of-course the error message is not very helpful!

Still, funny thing is, I can't update the service in my VS solution unless I turn Windows Authentication back on.

More reading needed I think!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top