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

  • SEARCH
  • Home
  • 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 8065651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:44:08+00:00 2026-06-05T11:44:08+00:00

I have a WCF service and a client that uses that service. They use

  • 0

I have a WCF service and a client that uses that service. They use WSHttpBinding with MTOM message encoding. The client doesn’t use an app.config file, and does all of the endpoint configuration in code.
It all works rather nicely in a normal environment, however I now have some users who are attempting to connect to the service from behind an http proxy. Whenever they try to connect, they get a 407 (Proxy Authentication Required) warning.

I’ve managed to set up my own testing environment using a virtual machine with a private network that connects to a proxy, so I can simulate what they are seeing.
I’ve tried setting the system.net useDefaultCredentials property in app.config, but that doesn’t seem to have any effect. I’ve examined the packets being sent, and they don’t contain any Proxy-Authentication headers. Looking at web traffic through the proxy, they do use that header.

I’ve also tried hard coding the proxy server into the client, but that gives a “cannot connect to server” exception. Examining the packets, the client sends out 3 small ones to the proxy, none of which are an http request, and that’s it. I’m not sure what it’s doing there.

I even went so far as to add a message inspector to the client, and manually inject the required header into the requests, but that’s not showing up in the header.

I’m hitting the end of my rope here, and I really need a solution. Any ideas on what I’m missing here, or a solution?

This ( WCF Service with wsHttpBinding – Manipulating HTTP request headers ) seems promising, but I’m still stuck.

EDIT:
Here’s a portion of the code.

            var binding = new WSHttpBinding();
            binding.MaxReceivedMessageSize = 100000000;
            binding.MessageEncoding = WSMessageEncoding.Mtom;
            binding.ReaderQuotas.MaxArrayLength = 100000000;
            binding.OpenTimeout = new TimeSpan(0, 2, 0);
            binding.ReceiveTimeout = new TimeSpan(0, 2, 0);
            binding.SendTimeout = new TimeSpan(0, 2, 0);
            binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;

            binding.UseDefaultWebProxy = true;
            // I've also tried setting this to false, and manually specifying the binding.ProxyAddress

            binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Basic;
            var endpointAddress = new EndpointAddress(new Uri(hostUrl));
            clientProxy_ = new UpdaterServiceProxy(binding, endpointAddress);

            // this behavior was the attempt to manually add the Proxy-Authentication header
            //clientProxy_.Endpoint.Behaviors.Add(new MyEndpointBehavior());

            clientProxy_.ClientCredentials.UserName.UserName = userName;
            clientProxy_.ClientCredentials.UserName.Password = password;
            clientProxy_.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode =
                    System.ServiceModel.Security.X509CertificateValidationMode.ChainTrust;
            // do stuff...
  • 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-06-05T11:44:10+00:00Added an answer on June 5, 2026 at 11:44 am

    After a lot of experimentation I’ve made some progress. It turns out that I can manually specify the proxy, and it will work.

    WebProxy proxy = new WebProxy("http://x.x.x.x:3128", false);
    proxy.Credentials = new NetworkCredential("user", "pass");
    WebRequest.DefaultWebProxy = proxy;
    

    That code appears just before I instantiate my clientProxy_. I had tried this previously, but it silently failed because I hadn’t specified the port. I still cannot get it to pick up the proxy settings specified in the Windows Internet Settings. I tried setting proxy.Credentials = CredentialCache.DefaultNetworkCredentials; but that also seemed to have no effect.

    I’m also running into a problem now with the client trying to validate the service’s certificate using ChainTrust, but the requests for the chained certificates are not using the proxy settings. Since this is a more specific question, I wrote it up separately here: Certificate validation doesn't use proxy settings for chaintrust

    So I’m still hoping for more help.

    UPDATE:
    I ended up just adding a network configuration dialog to my application so the user could specify their proxy settings. I’ve been unable to get the automatic proxy settings to work properly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF client/service app that relies on secure communication between two machines
I have a Linux/c client app that connects to a WCF web service over
I have WCF service that uses raw messages (Message class). 1) Service side: [DataContract]
I have a WCF service and a client, that uses a custom UserNamePasswordValidator for
I have WCF service that uses wsHttpBinding and authentication with certificate. I run this
I have an asyncronous WCF service, that uses a client proxy to call an
I have client application that uses WCF service to insert some data to backend
I have a desktop app that connects to a WCF service and uses WCF
I have a WCF Service that uses a X.509 certificate as client credentials. Most
I have a WCF Service that I want my client to be able to

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.