WCF Proxy Server settings not working

C

Clint

Hello,

I've been having a problem connecting to a standard ASMX file via WCF when
going through a proxy server. My setup is a little confusing, so I'll try to
explain it first before the problem ...

I have a series of services, some front-end interfaces (FE) for back-end
services (BE) that themselves may be an interface to a third party site. To
simplify, say I have three services:

1. Front-end "Research" service (WCF - SVC)
2. Back-end "ThirdPartyResearchWrapper" service (WCF - SVC)
3. Third party "MarketResearch" service (ASMX, sourced externally, not on
our intranet like (1) and (2))

Right now, Research has ThirdPartyResearchWrapper as a DLL reference.
ThirdPartyResearchWrapper has MarketResearch as a Service Reference (with all
the applicable client binding information in the Web.config file).

Now, I have a library that contains a bunch of nUnit tests. I have two tests
in particular - one that tests out ThirdPartyResearchWrapper (as a DLL
reference), and one that tests out Research as a Service Reference. I have
the following in my config files for both the test library and in Research's
web.config file:

<system.net>
<defaultProxy useDefaultCredentials="true">
<proxy usesystemdefault="False"
proxyaddress="http://[our proxy server's address]"
bypassonlocal="True" />
</defaultProxy>
</system.net>

The web site runs as a domain user that has internet access.

Now, if I run the test that goes directly to ThirdPartyResearchWrapper (via
the DLL link), my service call works just fine. If I run the test that goes
to Research (via Service Reference), I get "The remote server returned an
unexpected response: (407) Proxy Authentication Required.".

I've tried hard-coding the login/password to our proxy server within
ThirdPartyResearchWrapper where it calls MarketResearch and I've made sure
the config file is visible to ThirdPartyResearchWrapper, all with absolutely
no luck. To make matters worse, when I had MarketResearch referenced inside
ThirdPartyResearchWrapper as a Web Service Reference, everything worked fine.
I don't want to go back to this route as eventually I'll need to implement a
SOAP extension, and that's far easier via WCF than the non-WCF way.

I'd appreciate any help you can provide. I've pretty much wasted all day on
this looking for answers online, and have come up dry.

Thanks!
Clint
 
S

Steven Cheng

Hi Clint,

Based on your problem description, I understand that you're encountering a
proxy authentication issue when cosuming a remote servcie via WCF client,
correct?

I haven't researched the difference between webservice client and WCF
client yet. But based on my experience, since it works when you directly
call the "ThirdPartyResearchWrapper", but failed when you call it via
another local WCF service("Research") sevice, I think the problem is that
the "Research" service is not passing the correctly credentials for the
proxy authentication. Here is my analysis based on the topology of your
current service environment.

=============
Two approachs:

1. ClientApp----> "Research" Service (used the wrapper) ----> 3rd party
service

result: not work, proxy authentication error


2. ClientApp(directly use wrapper) ---> 3rd party service

result: works
==============

Since you've used " <defaultProxy useDefaultCredentials="true"> setting, we
know that in approach #1, it will use your application's running process
account to access the remote service(also proxy server), you can verify the
account.

In approach#2, since you access the remote 3rd party service via
intermediate "research service", therefore, the proxy authentication rely
on the security identity at "Research" service's web application context,
is it also using the same identity as the one in #1? I think this is what
you can try checking. If not, you can consider using the following means
to make the "Research" service use the specified account:

1. change the "Research" service's running process account(such as change
the IIS application pool identity)

2. You can use impersonate to programmtically make the certain
function/code running under a specify account


In addition, as you mentioned that

<<<<<<<<<<<<
I've tried hard-coding the login/password to our proxy server within
ThirdPartyResearchWrapper where it calls MarketResearch
would you show me the code you used?


Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.




--------------------
Thread-Topic: WCF Proxy Server settings not working
thread-index: AckjRwxoXqPAeJ7JQrSAWCIvDobtGA==
From: =?Utf-8?B?Q2xpbnQ=?= <[email protected]>
Subject: WCF Proxy Server settings not working
Date: Tue, 30 Sep 2008 14:54:01 -0700
Hello,

I've been having a problem connecting to a standard ASMX file via WCF when
going through a proxy server. My setup is a little confusing, so I'll try to
explain it first before the problem ...

I have a series of services, some front-end interfaces (FE) for back-end
services (BE) that themselves may be an interface to a third party site. To
simplify, say I have three services:

1. Front-end "Research" service (WCF - SVC)
2. Back-end "ThirdPartyResearchWrapper" service (WCF - SVC)
3. Third party "MarketResearch" service (ASMX, sourced externally, not on
our intranet like (1) and (2))

Right now, Research has ThirdPartyResearchWrapper as a DLL reference.
ThirdPartyResearchWrapper has MarketResearch as a Service Reference (with all
the applicable client binding information in the Web.config file).

Now, I have a library that contains a bunch of nUnit tests. I have two tests
in particular - one that tests out ThirdPartyResearchWrapper (as a DLL
reference), and one that tests out Research as a Service Reference. I have
the following in my config files for both the test library and in Research's
web.config file:

<system.net>
<defaultProxy useDefaultCredentials="true">
<proxy usesystemdefault="False"
proxyaddress="http://[our proxy server's address]"
bypassonlocal="True" />
</defaultProxy>
</system.net>

The web site runs as a domain user that has internet access.

Now, if I run the test that goes directly to ThirdPartyResearchWrapper (via
the DLL link), my service call works just fine. If I run the test that goes
to Research (via Service Reference), I get "The remote server returned an
unexpected response: (407) Proxy Authentication Required.".

I've tried hard-coding the login/password to our proxy server within
ThirdPartyResearchWrapper where it calls MarketResearch and I've made sure
the config file is visible to ThirdPartyResearchWrapper, all with absolutely
no luck. To make matters worse, when I had MarketResearch referenced inside
ThirdPartyResearchWrapper as a Web Service Reference, everything worked fine.
I don't want to go back to this route as eventually I'll need to implement a
SOAP extension, and that's far easier via WCF than the non-WCF way.

I'd appreciate any help you can provide. I've pretty much wasted all day on
this looking for answers online, and have come up dry.

Thanks!
Clint
 
C

Clint

Hi Steven,

Thanks for your reply! I looked into what you suggested about the user info,
and found that when I checked the Environment.UserName property under
approach 2, I see my username. When I check that property under approach 1,
it shows ASPNET. I changed the anonymous username in IIS (5.1 under XP) to a
domain account that has rights to the proxy server, and reran my tests. Still
the same thing - ASPNET shows up as the user.

I've attached the code I'm using below, as well as the relevent sections in
my Web.config file:

In Test Project:
[Test]
public void GetFullIndustryProfile()
{
// ResearchClient is the top level "Research" WCF service that is
referenced by a Service Reference
using (ResearchClient client = new ResearchClient())
{
IndustryResearchResponse response = client.GetIndustryProfile(1234);
// clipped Asserts
}
}

In "Research":
public IndustryResearchResponse GetMarketResearchInformation(int id)
{
// This is the intermediate wrapper and is referenced directly
ThirdPartyResearchWrapper wrapper = new ThirdPartyResearchWrapper();
IndustryResearchResponse profile = wrapper.GetIndustryProfile(id);

// clipped out code that does work on the resulting data
return profile
}

In "ThirdPartyResearchWrapper":
public IndustryResearchResponse GetIndustryProfile(int id)
{
// Create's a call to the external MarketResearch web service
using (MarketResearchSoapClient services = new MarketResearchSoapClient())
{
// I can comment the following line out and it doesn't make a
difference
services.ClientCredentials.Windows.ClientCredential =
ServiceAuthorization.GetServiceCredentials();

// This line throws the 407 - proxy authentication required message
IndustryResearchResponse response = services.FindMarketProfileById(id);

// clipped out code that does work on the resulting data
return response;
}
}

<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="MarketResearchSoap" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard" maxBufferSize="4194304"
maxBufferPoolSize="524288" maxReceivedMessageSize="4194304"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None"
proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName"
algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="WSHttpBinding_IResearch" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false"
hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="4194304"
maxReceivedMessageSize="4194304" messageEncoding="Text" textEncoding="utf-8"
useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="4194304"
maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"
/>
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows"
proxyCredentialType="None" realm="" />
<message clientCredentialType="Windows"
negotiateServiceCredential="true" algorithmSuite="Default"
establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/ResearchService/Research.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IResearch"
contract="ResearchService.IResearch" name="WSHttpBinding_IResearch">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="http://public.internet.site/MarketResearch.asmx"
binding="basicHttpBinding" bindingConfiguration="MarketResearchSoap"
contract="MarketResearchServices.MarketResearchSoap"
name="MarketResearchSoap" />
</client>
</system.serviceModel>

Thanks!
Clint

"Steven Cheng" said:
Hi Clint,

Based on your problem description, I understand that you're encountering a
proxy authentication issue when cosuming a remote servcie via WCF client,
correct?

I haven't researched the difference between webservice client and WCF
client yet. But based on my experience, since it works when you directly
call the "ThirdPartyResearchWrapper", but failed when you call it via
another local WCF service("Research") sevice, I think the problem is that
the "Research" service is not passing the correctly credentials for the
proxy authentication. Here is my analysis based on the topology of your
current service environment.

=============
Two approachs:

1. ClientApp----> "Research" Service (used the wrapper) ----> 3rd party
service

result: not work, proxy authentication error


2. ClientApp(directly use wrapper) ---> 3rd party service

result: works
==============

Since you've used " <defaultProxy useDefaultCredentials="true"> setting, we
know that in approach #1, it will use your application's running process
account to access the remote service(also proxy server), you can verify the
account.

In approach#2, since you access the remote 3rd party service via
intermediate "research service", therefore, the proxy authentication rely
on the security identity at "Research" service's web application context,
is it also using the same identity as the one in #1? I think this is what
you can try checking. If not, you can consider using the following means
to make the "Research" service use the specified account:

1. change the "Research" service's running process account(such as change
the IIS application pool identity)

2. You can use impersonate to programmtically make the certain
function/code running under a specify account


In addition, as you mentioned that

<<<<<<<<<<<<
I've tried hard-coding the login/password to our proxy server within
ThirdPartyResearchWrapper where it calls MarketResearch
would you show me the code you used?


Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.




--------------------
Thread-Topic: WCF Proxy Server settings not working
thread-index: AckjRwxoXqPAeJ7JQrSAWCIvDobtGA==
From: =?Utf-8?B?Q2xpbnQ=?= <[email protected]>
Subject: WCF Proxy Server settings not working
Date: Tue, 30 Sep 2008 14:54:01 -0700
Hello,

I've been having a problem connecting to a standard ASMX file via WCF when
going through a proxy server. My setup is a little confusing, so I'll try to
explain it first before the problem ...

I have a series of services, some front-end interfaces (FE) for back-end
services (BE) that themselves may be an interface to a third party site. To
simplify, say I have three services:

1. Front-end "Research" service (WCF - SVC)
2. Back-end "ThirdPartyResearchWrapper" service (WCF - SVC)
3. Third party "MarketResearch" service (ASMX, sourced externally, not on
our intranet like (1) and (2))

Right now, Research has ThirdPartyResearchWrapper as a DLL reference.
ThirdPartyResearchWrapper has MarketResearch as a Service Reference (with all
the applicable client binding information in the Web.config file).

Now, I have a library that contains a bunch of nUnit tests. I have two tests
in particular - one that tests out ThirdPartyResearchWrapper (as a DLL
reference), and one that tests out Research as a Service Reference. I have
the following in my config files for both the test library and in Research's
web.config file:

<system.net>
<defaultProxy useDefaultCredentials="true">
<proxy usesystemdefault="False"
proxyaddress="http://[our proxy server's address]"
bypassonlocal="True" />
</defaultProxy>
</system.net>

The web site runs as a domain user that has internet access.

Now, if I run the test that goes directly to ThirdPartyResearchWrapper (via
the DLL link), my service call works just fine. If I run the test that goes
to Research (via Service Reference), I get "The remote server returned an
unexpected response: (407) Proxy Authentication Required.".

I've tried hard-coding the login/password to our proxy server within
ThirdPartyResearchWrapper where it calls MarketResearch and I've made sure
the config file is visible to ThirdPartyResearchWrapper, all with absolutely
no luck. To make matters worse, when I had MarketResearch referenced inside
ThirdPartyResearchWrapper as a Web Service Reference, everything worked fine.
I don't want to go back to this route as eventually I'll need to implement a
SOAP extension, and that's far easier via WCF than the non-WCF way.

I'd appreciate any help you can provide. I've pretty much wasted all day on
this looking for answers online, and have come up dry.

Thanks!
Clint
 
S

Steven Cheng

Thanks for your reply Clint,

Based on your further descrpition, we can get that it is in the #1
approach("Research" service), the running security account is not the
correct one, that cause the proxy authentication failed.

Why are you changing the "anonymous user account" in IIS? Anonymous user
just represent the account that will be associated with each request(when
anonymous is enabled in IIS). However, for ASP.NET application(host
webservice or WCF), if you haven't do impersonate on the application or
each thread(by web.config or programmatically), that account won't affect
the security context of your ASP.NET web application. Also, from IIS
security perspective, it is always not good idea to set "anonymous account"
to a privileged one.

For your scenario, since you are using IIS5/XP, I think you should try
changing the worker process account of your ASP.NET web application. That
can be done by the <processModel> element in machine .config file. Here are
some reference articles which explains this:

#Process and request identity in ASP.NET
http://support.microsoft.com/kb/317012

#processModel Element (ASP.NET Settings Schema)
http://msdn.microsoft.com/en-us/library/7w2sway1.aspx

Assign an account which is valid to the remote proxy server in the
username/password attributes of the <processModel> element:

this is different from IIS6(Where you can use ApplicationPool to specify
the process account you want to use).

If there is anything unclear, please feel free to let me know.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
From: =?Utf-8?B?Q2xpbnQ=?= <[email protected]>
References: <[email protected]>
Subject: RE: WCF Proxy Server settings not working
Date: Wed, 1 Oct 2008 08:46:01 -0700
Hi Steven,

Thanks for your reply! I looked into what you suggested about the user info,
and found that when I checked the Environment.UserName property under
approach 2, I see my username. When I check that property under approach 1,
it shows ASPNET. I changed the anonymous username in IIS (5.1 under XP) to a
domain account that has rights to the proxy server, and reran my tests. Still
the same thing - ASPNET shows up as the user.

I've attached the code I'm using below, as well as the relevent sections in
my Web.config file:

In Test Project:
[Test]
public void GetFullIndustryProfile()
{
// ResearchClient is the top level "Research" WCF service that is
referenced by a Service Reference
using (ResearchClient client = new ResearchClient())
{
IndustryResearchResponse response = client.GetIndustryProfile(1234);
// clipped Asserts
}
}
 
C

Clint

I do have a few additional questions - sorry!

I had changed the anonymous user to a privileged user (this is on my
development workstation, not for public use - we're on Windows 2003 in
production, and would go down the Application Pool route you described) to
have the request for that site run as that user. That wasn't successful
anyway, so I changed it back to the PC's anonymous user.

As for processModel, I'd like to shy away from changing my machine.config
file, so I tried setting <identity impersonate="true" userName="..."
password="..."/> and, thinking that would make a difference, tried running
the project. Still no luck. Why wouldn't this work? Doesn't this force the
project to run under the context of whatever's in the identity element?

Also, why is it that I can make this work via a regular Web Service
reference, but not through a Service Reference? In a web reference, I can set
client credentials and proxy information through code, but not through a WCF
service (that I can see). Is there a way to do this that I'm missing?

Thanks again!


"Steven Cheng" said:
Thanks for your reply Clint,

Based on your further descrpition, we can get that it is in the #1
approach("Research" service), the running security account is not the
correct one, that cause the proxy authentication failed.

Why are you changing the "anonymous user account" in IIS? Anonymous user
just represent the account that will be associated with each request(when
anonymous is enabled in IIS). However, for ASP.NET application(host
webservice or WCF), if you haven't do impersonate on the application or
each thread(by web.config or programmatically), that account won't affect
the security context of your ASP.NET web application. Also, from IIS
security perspective, it is always not good idea to set "anonymous account"
to a privileged one.

For your scenario, since you are using IIS5/XP, I think you should try
changing the worker process account of your ASP.NET web application. That
can be done by the <processModel> element in machine .config file. Here are
some reference articles which explains this:

#Process and request identity in ASP.NET
http://support.microsoft.com/kb/317012

#processModel Element (ASP.NET Settings Schema)
http://msdn.microsoft.com/en-us/library/7w2sway1.aspx

Assign an account which is valid to the remote proxy server in the
username/password attributes of the <processModel> element:

this is different from IIS6(Where you can use ApplicationPool to specify
the process account you want to use).

If there is anything unclear, please feel free to let me know.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
From: =?Utf-8?B?Q2xpbnQ=?= <[email protected]>
References: <[email protected]>
Subject: RE: WCF Proxy Server settings not working
Date: Wed, 1 Oct 2008 08:46:01 -0700
Hi Steven,

Thanks for your reply! I looked into what you suggested about the user info,
and found that when I checked the Environment.UserName property under
approach 2, I see my username. When I check that property under approach 1,
it shows ASPNET. I changed the anonymous username in IIS (5.1 under XP) to a
domain account that has rights to the proxy server, and reran my tests. Still
the same thing - ASPNET shows up as the user.

I've attached the code I'm using below, as well as the relevent sections in
my Web.config file:

In Test Project:
[Test]
public void GetFullIndustryProfile()
{
// ResearchClient is the top level "Research" WCF service that is
referenced by a Service Reference
using (ResearchClient client = new ResearchClient())
{
IndustryResearchResponse response = client.GetIndustryProfile(1234);
// clipped Asserts
}
}
 
S

Steven Cheng

Thanks for your reply Clint,

For the production environment, even if you switch the Application Pool
identity, it still not work? Then, what's the account displayed if you use
WindowsIdentity.GetCurrent() to check it?

Also, on the XP box, It's also a bit unexpected that <identity
impersonate="true" userName="..." password="..."/> not work. I think by
using this setting, you'll get the custom account displayed via
WindowsIdentity.GetCurrent(), correct? If this is the case, I think there
is likely to be some thing specfic to WCF client transport channel's
implementation on acquiring the security credential for proxy. Currently
I'm also forwarding this issue to some other WCF engineers for more ideas
on this. I'll let you know if I get any update on this.

BTW, since on your xp machine, it used to display MACHINE\ASPNET account,
at least this indicate that it is using the xp/iis5's default worker
process account. If possible, you can try switching the <processModel>
element for testing to verify the behavior.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.



--------------------
<8r4#[email protected]>
 
C

Clint

Hi Steven,

Sorry for the late reply - I was out of the office the last few days.

I haven't tried this in our production environment yet, but I have little
doubt it will work, since this is just part of the overall solution, and with
the application pool settings set correctly, the w3wp.exe process is running
under the internet access user, not an anonymous or machine user.

I'm not sure what's going on with Identity Impersonate, but I tried this:

<system.web>
<identity impersonate="true" userName="domain\login" password="password"/>
<authentication mode="Windows"/>
<authorization>
<deny users="?"/>
</authorization>
</system.web>

in the "Research" service's web.config, and WindowsIdentity.GetCurrent()
still returned ASPNET. That leads me to believe that there's something more
going on here than just WCF, but I don't know what. I've used that before and
had luck ...

Regarding the processModel - changing that did work. I'll keep that set for
now since I need to test this, but if you can find any answers regarding
passing the credentials through to WCF, I'd greatly appreciate it.

Thanks!
Clint
 
S

Steven Cheng

Hi Clint,

I've performed some further research on this issue and discussed with some
WCF dev engineers. Here are some further information we've got for your
information:

For WCF service, when we set the binding configuration as
"useDefaultWebProxy=true" such as:

==================
<binding name="BasicHttpBinding_IService" ................
useDefaultWebProxy="true">
==================

the WCF runtime will acquire proxy setting from WebRequest.DefaultWebProxy
class.

And since this global setting is changable, you can manually assign a new
proxy for the defaultWebProxy property. e.g.

===================
WCFSVC.ServiceClient client = new ConsoleClient.WCFSVC.ServiceClient();

WebProxy wproxy = new WebProxy("new proxy",true);
wproxy.Credentials = CredentialCache.DefaultNetworkCredentials;

WebRequest.DefaultWebProxy = wproxy;

===================

here are some reference articles mentioned more info about the background
of the proxy settings in WCF:

#Configuration Http Proxies in WCF
http://kennyw.com/indigo/106

#Setting Credentials for your HTTP Proxy
http://kennyw.com/indigo/143

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
 
S

Steven Cheng

Hi Clint,

does the further information help you some? If there is still anything else
we can help, please feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

--------------------
 
C

Clint

Hi Steven,

I'm sorry - I must not have checked to have notifications sent to me. I did
your suggestion with setting WebRequest.DefaultWebProxy and it worked
perfectly - exactly what I wanted to do.

Thanks!
Clint
 
S

Steven Cheng

Hi Clint,

Glad to hear from you.

I'm very glad that the suggestion worked for you.

Have a good day!

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,832
Latest member
GlennSmall

Latest Threads

Top