MSDN > 論壇首頁 > 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日 下午 02: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日 下午 08: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日 下午 09: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日 下午 08: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日 下午 08: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日 上午 08: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日 下午 04:04Rxra 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    Thanks a lot Steven.
    I was able to fix it today.


    Rx