Microsoft 开发人员网络 > 论坛主页 > Windows Communication Foundation > Cannot provide access to users behind internet proxy server - wshttp endpoint
提出问题提出问题
 

已答复Cannot provide access to users behind internet proxy server - wshttp endpoint

  • 2009年7月2日 14:15Rxra 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     包含代码

    IIS (service is configured) & Windows client application uses the service for bi-directional services.

     IIS Config:

    <!-- Server config -->
    <system.serviceModel>
                                    <bindings>
                                                    <wsHttpBinding>
                                                                    <binding name="NoSecurity" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:10:00"  sendTimeout="00:05:00" bypassProxyOnLocal="false" transactionFlow="false"
                                                                                      hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"    maxReceivedMessageSize="50000000" messageEncoding="Text" textEncoding="utf-8"   useDefaultWebProxy="true" allowCookies="false">
                                                                                    <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"  maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                                                                                    <security mode="None"/>
                                                                    </binding>
                                                    </wsHttpBinding>
                                    </bindings>
                                    <services>
                                                    <service name="CcsClientDataSyncServices.CcsDataCacheSyncService" behaviorConfiguration="CcsClientDataSyncServices.CcsDataCacheSyncServiceBehavior">
                                                                    <endpoint address ="" binding="wsHttpBinding"  contract="CcsClientDataSyncServices.ICcsDataCacheSyncContract" bindingConfiguration="NoSecurity"/>
                                                                    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
                                                    </service>
                                    </services>
                                    <behaviors>
                                                    <serviceBehaviors>
                                                                    <behavior name="CcsClientDataSyncServices.CcsDataCacheSyncServiceBehavior">
                                                                                    <serviceMetadata httpGetEnabled="True" />
                                                                                    <serviceDebug includeExceptionDetailInFaults="True" />
                                                                    </behavior>
                                                    </serviceBehaviors>
                                    </behaviors>
                    </system.serviceModel>
    
    <!-- Client config -->
    <system.serviceModel>
        <bindings>
          <wsHttpBinding>
            <binding name="NoSecurity" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="50000000" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
              <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
              <security mode="None" />
            </binding>
          </wsHttpBinding>
        </bindings>
        <client>
          <endpoint address="http://testserver:81/CcsClientDataSyncServices/Service.svc"
        binding="wsHttpBinding"
           bindingConfiguration="NoSecurity"
           contract="ServiceReference.ICcsDataCacheSyncContract"
        name="WSHttpBinding_ICcsDataCacheSyncContract">
            <identity>
              <servicePrincipalName value="host\rajeshtest" />
            </identity>
          </endpoint>
        </client>
      </system.serviceModel>
    
    

    Some of the client’s (windows application) pc internet connection is behind a proxy, how do I configure and what are the settings I should provide them to connect to the service?

    Thnks,

    Raj


    Rx

答案

全部回复

  • 2009年7月3日 20:52Lars WilhelmsenMVP, 版主用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     
    Hi,

     Could you please elaborate a bit more on the exceptions / behavior you are experiencing?

     --larsw
    Lars Wilhelmsen | Senior Consultant | Miles, Norway | Connected Systems MVP | http://larswilhelmsen.com/
  • 2009年7月3日 21:23Nordine Ben Bachir 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     

    You can specify the proxy address manually if you need to:
    <system.net>
          <defaultProxy useDefaultCredentials="true" >
             <proxy autoDetect="False" usesystemdefault="False" bypassonlocal="true" proxyaddress="http://gateway:8080"  />
          </defaultProxy>
     </system.net>


    Nordine Ben Bachir
  • 2009年7月6日 20:50Rxra 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     
    Hi Larsw,
    One of my client has a problem with synchronizing with the server and the error is as below:
     - Exception has been thrown by the target of an invocation.
    System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (407) Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy service is denied.  ). ---> System.Net.WebException: The remote server returned an error: (407) Proxy Authentication Required.
       at System.Net.HttpWebRequest.GetResponse()
       at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
       --- End of inner exception stack trace ---

    Their internet is behind a proxy , so I have to provide a proxy config in my windows application.

    I dont have much knowledge in WCF security.

    Thks,
    Raj


    Rx
  • 2009年7月6日 20:56Rxra 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     包含代码
    Hi Nordine,
    I am trying out as you said, and providing client credentials
    ServiceReference.RxDataCacheSyncContractClient _cc = new RxClient.ServiceReference.RxDataCacheSyncContractClient();
    _cc.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential(System.Configuration.ConfigurationSettings.AppSettings["ProxyUser"], System.Configuration.ConfigurationSettings.AppSettings["ProxyPassword"]);
    this.RemoteProvider = new Microsoft.Synchronization.Data.ServerSyncProviderProxy(_cc);
    
    So far didnt work, still trying out.

    Thks,
    Raj

    Rx
  • 2009年7月8日 8:23Steven Cheng - MSFTMSFT, 版主用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     已答复

    Hi Rxra,

    The error message you provided did indicate that those certain clients are behind are firewall proxy and the proxy requires authentication against the client. I've posted a former article which mentioned how to supply dedicated credentials for proxy authentiation in WCF client:

    #[WCF]How to supply dedicated credentials for webproxy authentication in WCF client
    http://blogs.msdn.com/stcheng/archive/2008/12/03/wcf-how-to-supply-dedicated-credentials-for-webproxy-authentication.aspx

    The idea here is utilize the WebRequest.DefaultProxy to supply your info. Generally, if proxy server doesn't require authentication, you can use app.config to supply proxy address info.




    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • 2009年7月10日 16:04Rxra 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     
    Thanks a lot Steven.
    I was able to fix it today.


    Rx