Microsoft Developer Network > Domovská stránka fór > Windows Communication Foundation > Cannot provide access to users behind internet proxy server - wshttp endpoint
Odeslat dotazOdeslat dotaz
 

OdpovědětCannot provide access to users behind internet proxy server - wshttp endpoint

  • 2. července 2009 14:15Rxra Uživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaile
     Obsahuje kód

    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

Odpovědi

Všechny reakce

  • 3. července 2009 20:52Lars WilhelmsenMVP, ModerátorUživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaile
     
    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/
  • 3. července 2009 21:23Nordine Ben Bachir Uživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaile
     

    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
  • 6. července 2009 20:50Rxra Uživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaile
     
    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
  • 6. července 2009 20:56Rxra Uživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaile
     Obsahuje kód
    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
  • 8. července 2009 8:23Steven Cheng - MSFTMSFT, ModerátorUživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaile
     Odpovědět

    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.
  • 10. července 2009 16:04Rxra Uživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaile
     
    Thanks a lot Steven.
    I was able to fix it today.


    Rx