Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7179775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:12:31+00:00 2026-05-28T17:12:31+00:00

I’m calling a web service via WCF (w/ .NET 4.0) that requires basic HTTP

  • 0

I’m calling a web service via WCF (w/ .NET 4.0) that requires basic HTTP authentication (with username and password.) over HTTPS. While, I think I’ve got everything setup correctly, I’m getting a 401 error whenever I make the call to the service. I monitored the HTTP traffic and noticed that WCF seems to be ignoring that I told it to use an authorization header with the username and password, as none is sent in the request. Here’s my configuration below. Any ideas? Thanks!

   <system.serviceModel>
         <bindings>
                <basicHttpBinding>
                       <binding name="BasicAuthSecured">
                             <security mode="Transport">
                                    <transport clientCredentialType="Basic" />
                             </security>
                       </binding>
                       </basicHttpBinding>
                </bindings>
         <client>
                <endpoint address="https://REMOVED FOR CONFIDENTIALITY"
            binding="basicHttpBinding" bindingConfiguration="BasicAuthSecured"
            contract="Five9.WsAdmin" name="WsAdminPort" />
         </client>
         <behaviors>
                <serviceBehaviors>
                       <behavior name="">
                             <serviceMetadata httpsGetEnabled="true"/>
                             <serviceDebug includeExceptionDetailInFaults="true"/>
                       </behavior>
                </serviceBehaviors>
         </behaviors>
   </system.serviceModel>

And here’s my code:

        var five_9_client = new WsAdminClient();

        five_9_client.ClientCredentials.UserName.UserName = “REMOVED FOR CONFIDENTIALITY";
        five_9_client.ClientCredentials.UserName.Password = "REMOVED FOR CONFIDENTIALITY";

        var call_log_response = five_9_client.getCallLogReport(call_log); //Bombing out here

I’m getting this exception:

{“The HTTP request is unauthorized with client authentication scheme ‘Basic’. The authentication header received from the server was ”.”}

With inner exception:

{“The remote server returned an error: (401) Unauthorized.”}

With stack trace:

at System.ServiceModel.Channels.HttpChannelUtilities.ValidateAuthentication(HttpWebRequest request, HttpWebResponse response, WebException responseException, HttpChannelFactory factory)
at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T17:12:33+00:00Added an answer on May 28, 2026 at 5:12 pm

    Found the solution: basically, the problem was that the header had to be attached to the current request, like so:

          var base_64_encoded_credentials =
                BasicHTTPAuthenticationEncoder.base_64_encode_credentials(
                    client.ClientCredentials.UserName.UserName, client.ClientCredentials.UserName.Password);
    
            HttpRequestMessageProperty request = new HttpRequestMessageProperty();
            request.Headers[System.Net.HttpRequestHeader.Authorization] = "Basic " + base_64_encoded_credentials;
    
            OperationContextScope clientScope = new OperationContextScope(five_9_client.InnerChannel);
            OperationContext.Current.OutgoingMessageProperties.Add(HttpRequestMessageProperty.Name, request);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to invoke an ASP.NET web service via an http POST request using
I have a WCF web service which allows both Basic HTTP and WS-HTTP clients,
I'm connecting to a web service over HTTPS. I've done all that I think
I'm calling a web service that returns an array of objects in JSON. I
My superior once told me that a bad way of calling a web service
I am calling a web service via a httpwebrequest, and getting a response. The
My application access the HSM via a ASP.NET web service through PKCS#11. I initialise
I am querying a sharepoint list via the web service api. Calling the service
Visual Studio makes calling a web service easy, trying to figure out what is
I am calling a web service from a C# forms based app. ServReturnType obj

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.