WCF Proxy Server settings not working

Discussion in 'ASP .Net Web Services' started by Clint, Sep 30, 2008.

  1. Clint

    Clint Guest

    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
    Clint, Sep 30, 2008
    #1
    1. Advertising

  2. Clint

    Steven Cheng Guest

    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:
    .

    ==================================================
    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=?= <>
    >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
    >
    Steven Cheng, Oct 1, 2008
    #2
    1. Advertising

  3. Clint

    Clint Guest

    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"" wrote:

    > 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:
    > .
    >
    > ==================================================
    > 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=?= <>
    > >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
    > >

    >
    >
    Clint, Oct 1, 2008
    #3
  4. Clint

    Steven Cheng Guest

    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:
    .

    ==================================================
    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=?= <>
    >References: <>

    <8r4#>
    >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
    > }
    >}
    >
    Steven Cheng, Oct 2, 2008
    #4
  5. Clint

    Clint Guest

    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"" wrote:

    > 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:
    > .
    >
    > ==================================================
    > 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=?= <>
    > >References: <>

    > <8r4#>
    > >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
    > > }
    > >}
    > >

    >
    >
    Clint, Oct 2, 2008
    #5
  6. Clint

    Steven Cheng Guest

    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:
    .

    ==================================================
    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.



    --------------------
    >References: <>

    <8r4#>
    <>
    <>
    >Subject: RE: WCF Proxy Server settings not working
    >Date: Thu, 2 Oct 2008 07:36:01 -0700


    >
    >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"" wrote:
    >
    >> 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.
    >>
    >>
    Steven Cheng, Oct 3, 2008
    #6
  7. Clint

    Clint Guest

    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

    ""Steven Cheng"" wrote:

    > 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:
    > .
    >
    > ==================================================
    > 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.
    >
    >
    >
    > --------------------
    > >References: <>

    > <8r4#>
    > <>
    > <>
    > >Subject: RE: WCF Proxy Server settings not working
    > >Date: Thu, 2 Oct 2008 07:36:01 -0700

    >
    > >
    > >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"" wrote:
    > >
    > >> 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.
    > >>
    > >>

    >
    >
    Clint, Oct 7, 2008
    #7
  8. Clint

    Steven Cheng Guest

    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:
    .

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


    --------------------
    >Subject: RE: WCF Proxy Server settings not working
    >Date: Tue, 7 Oct 2008 08:48:01 -0700


    >
    >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
    >
    Steven Cheng, Oct 10, 2008
    #8
  9. Clint

    Steven Cheng Guest

    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:
    .

    --------------------
    >Content-Type: text/plain
    >Content-Transfer-Encoding: 7bit
    >From: ("Steven Cheng")
    >Organization: Microsoft
    >Date: Fri, 10 Oct 2008 08:12:00 GMT
    >Subject: RE: WCF Proxy Server settings not working


    >Path: TK2MSFTNGHUB02.phx.gbl
    >Xref: TK2MSFTNGHUB02.phx.gbl

    microsoft.public.dotnet.framework.aspnet.webservices:2729
    >NNTP-Posting-Host: 10.201.220.210
    >
    >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:
    >.
    >
    >==================================================
    >This posting is provided "AS IS" with no warranties, and confers no rights.
    >
    >
    >--------------------
    >>Subject: RE: WCF Proxy Server settings not working
    >>Date: Tue, 7 Oct 2008 08:48:01 -0700

    >
    >>
    >>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
    >>

    >
    >
    Steven Cheng, Oct 14, 2008
    #9
  10. Clint

    Clint Guest

    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

    ""Steven Cheng"" wrote:

    > 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:
    > .
    >
    > --------------------
    > >Content-Type: text/plain
    > >Content-Transfer-Encoding: 7bit
    > >From: ("Steven Cheng")
    > >Organization: Microsoft
    > >Date: Fri, 10 Oct 2008 08:12:00 GMT
    > >Subject: RE: WCF Proxy Server settings not working

    >
    > >Path: TK2MSFTNGHUB02.phx.gbl
    > >Xref: TK2MSFTNGHUB02.phx.gbl

    > microsoft.public.dotnet.framework.aspnet.webservices:2729
    > >NNTP-Posting-Host: 10.201.220.210
    > >
    > >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:
    > >.
    > >
    > >==================================================
    > >This posting is provided "AS IS" with no warranties, and confers no rights.
    > >
    > >
    > >--------------------
    > >>Subject: RE: WCF Proxy Server settings not working
    > >>Date: Tue, 7 Oct 2008 08:48:01 -0700

    > >
    > >>
    > >>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
    > >>

    > >
    > >

    >
    >
    Clint, Oct 16, 2008
    #10
  11. Clint

    Steven Cheng Guest

    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:
    .

    --------------------
    >Subject: RE: WCF Proxy Server settings not working
    >Date: Thu, 16 Oct 2008 09:32:11 -0700


    >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
    >
    >""Steven Cheng"" wrote:
    >
    >> 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:
    >> .
    >>
    >> --------------------
    >> >Content-Type: text/plain
    >> >Content-Transfer-Encoding: 7bit
    >> >From: ("Steven Cheng")
    >> >Organization: Microsoft
    >> >Date: Fri, 10 Oct 2008 08:12:00 GMT
    >> >Subject: RE: WCF Proxy Server settings not working

    >>
    >> >Path: TK2MSFTNGHUB02.phx.gbl
    >> >Xref: TK2MSFTNGHUB02.phx.gbl

    >> microsoft.public.dotnet.framework.aspnet.webservices:2729
    >> >NNTP-Posting-Host: 10.201.220.210
    >> >
    >> >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:
    >> >.
    >> >
    >> >==================================================
    >> >This posting is provided "AS IS" with no warranties, and confers no

    rights.
    >> >
    >> >
    >> >--------------------
    >> >>Subject: RE: WCF Proxy Server settings not working
    >> >>Date: Tue, 7 Oct 2008 08:48:01 -0700
    >> >
    >> >>
    >> >>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
    >> >>
    >> >
    >> >

    >>
    >>

    >
    Steven Cheng, Oct 17, 2008
    #11
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon
    Replies:
    0
    Views:
    991
    Simon
    Oct 13, 2009
  2. donet programmer
    Replies:
    3
    Views:
    1,515
    Gregory A. Beamer
    Nov 20, 2009
  3. Cindy Lee
    Replies:
    1
    Views:
    2,063
    Mr. Arnold
    Mar 19, 2010
  4. SESDev
    Replies:
    6
    Views:
    2,733
    manjerekar annaji rao
    Oct 29, 2009
  5. Kenneth Jonsson

    Using IE proxy server settings in a web service client

    Kenneth Jonsson, Apr 7, 2010, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    1,013
    Kenneth Jonsson
    Apr 7, 2010
Loading...

Share This Page