SDL Developer
SDL Developer

Reputation: 612

The remote server returned an unexpected response: (407) Proxy Authorization Required

I am trying to connect to core service giving a particular user's credentials most of the time it works but sometimes I get proxy 407 error (as written in title of this question), this auto get resolved after 10-15 minutes and then I am able to connect to core service again. Is there a permanent solution for this issue? I know this is a simple question but I can't give credentials as System.Net.CredentialCache.DefaultCredentials; or as other solution available on web. Below is the code of my connection to core service, this problem occurs even if I call client.Close() after each operation.

core_service.ServiceReference1.SessionAwareCoreService2010Client client = new SessionAwareCoreService2010Client(); 
    client.ClientCredentials.Windows.ClientCredential.UserName = "myUserName"; 
    client.ClientCredentials.Windows.ClientCredential.Password = "myPassword"; client.Open();

 if (client.State == System.ServiceModel.CommunicationState.Opened)
            {
                // some code                }

Upvotes: 0

Views: 1255

Answers (3)

SDL Developer
SDL Developer

Reputation: 612

Might be the solution is in increasing Timeout of an endpoint I have update Timeout to 15 minutes from existing 1 minutes, below is the code of a particular endpoint of app.config

    <binding name="wsHttp_2010" closeTimeout="00:15:00" openTimeout="00:15:00"
                receiveTimeout="00:10:00" sendTimeout="00:15:00" bypassProxyOnLocal="false"
                transactionFlow="true" hostNameComparisonMode="StrongWildcard"
                maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                allowCookies="false">

Lets ses if this works, please suggests if I need to do any other changes in config file.

Upvotes: 0

Ram Saurabh
Ram Saurabh

Reputation: 1584

Sometimes it happens when you use Fiddler type web debugging tool. Can you try to set the proxy credentials directly to find out the reason as below -

request.Proxy = new WebProxy("proxyIp", 8080);
 request.Proxy.Credentials = CredentialCache.DefaultCredentials; 

Note:- above suggestion is based on my .net experience not on tridion core service.

Upvotes: 2

Shekhar Gigras
Shekhar Gigras

Reputation: 654

Try this instead of "SessionAwareCoreService2010Client" use "CoreService2010Client"

var objclient = new CoreService2010Client();
            objclient.ClientCredentials.Windows.ClientCredential.UserName = Generation.Settings.Username;
            objclient.ClientCredentials.Windows.ClientCredential.Password = Generation.Settings.Password;
            objclient.Open();

Upvotes: 3

Related Questions