none
net.tcp & clients behind a proxy server RRS feed

  • Question

  • Hi, 

    Is there a way to configure proxy settings for net.tcp on the client side?

    I have some services running on a server that isn't behind a proxy server, and a xbap application connecting to this service using net.tcp.

    Some users of the system are behind proxy servers, that requires authentication.

    For the most part their admins just allow the traffic through, but others are far stricter, and require that all traffic must go through the proxy server.

    Is there a way to configure this for a WCF client of net.tcp? The only way I could get passed this, was to create a wshttp endpoint, just for these cases.

    So 1. attempt to connect using net.tcp. 2. If it fails then connect using https. I would prefer that all traffic was tcp ip based.

     

    Cheers,

    Stian Farstad

    Friday, August 26, 2011 10:26 AM

Answers

  • Hello, the most reliable solution is to install a proxy configuration tool on the client machine, and perform some global configuration for all applications on the machine. For example, if the proxy server is an ISA server, the client should install ISA client, and let it automatically configure the proxy.

    You can also configure the proxy in app.config or in code. But this may not work for your scenario. Since you're using XBAP, it is recommended not to use app.config, because by default, the server prevents .config files to be downloaded to the client machine. This leaves you the only option: hard code proxy settings in your code. But obviously this won't work for all clients.

    So I suggest you to let your clients configure the proxies by themselves. After all, even if you've managed to configure your application to connect to your service using some application specific code, the clients will be unable to use other network connected applications because they have not configured the proxy server...


    Lante, shanaolanxing This posting is provided "AS IS" with no warranties, and confers no rights.
    Windows Azure Technical Forum Support Team Blog
    • Marked as answer by Yi-Lun Luo Thursday, September 1, 2011 9:28 AM
    Monday, August 29, 2011 3:11 AM

All replies

  • Hello, the most reliable solution is to install a proxy configuration tool on the client machine, and perform some global configuration for all applications on the machine. For example, if the proxy server is an ISA server, the client should install ISA client, and let it automatically configure the proxy.

    You can also configure the proxy in app.config or in code. But this may not work for your scenario. Since you're using XBAP, it is recommended not to use app.config, because by default, the server prevents .config files to be downloaded to the client machine. This leaves you the only option: hard code proxy settings in your code. But obviously this won't work for all clients.

    So I suggest you to let your clients configure the proxies by themselves. After all, even if you've managed to configure your application to connect to your service using some application specific code, the clients will be unable to use other network connected applications because they have not configured the proxy server...


    Lante, shanaolanxing This posting is provided "AS IS" with no warranties, and confers no rights.
    Windows Azure Technical Forum Support Team Blog
    • Marked as answer by Yi-Lun Luo Thursday, September 1, 2011 9:28 AM
    Monday, August 29, 2011 3:11 AM
  • Hello, thank you for your reply.

     

    Does net.tcp even support proxy settings? There are no properties like on wshttp/basic http for it.

    Forinstance the following will have no effect on a net.tcp binding:

                WebProxy proxy = new WebProxy("http://195.159.243.91:8080");

                proxy.Credentials = CredentialCache.DefaultCredentials;

                WebRequest.DefaultWebProxy = proxy;

    While ignoring these settings on the client connected to a proxy server yields:

    "The remote server returned an unexpected response: (407) Proxy access denied"

    On the proxyserver I test against now it works with net.tcp because it lets it through, but what I'm concerned about is that when I go live, the users in envirnoments described above, will be blocked and can't use the system.

    So I added a wsHttp endpoint & binding to the projects. Here I face another issue.

    When connected I first get a:

    "The remote server returned an unexpected response: (417) Expectation."

    Which the following line fixes:

    System.Net.ServicePointManager.Expect100Continue = false;

    "The HTTP service located at http://xxxx:xxxx/MainService is too busy. "

    innerexception: "The remote server returned an error: (503) Server Unavailable."

    Why does this happen? I've already configured the ServiceThrottlingBehavior to have a large number on MaxConcurrentCalls, MaxConcurrentInstances and MaxConcurrentSessions (10000).

     

    This only occurs when I've configured the client to through the proxyserver.

    Brgrds,

    Stian Farstad

    Wednesday, September 7, 2011 2:52 PM
  • As mentioned above, please do not hard code proxy settings in the client application. This may work for a particular client. But if the client application is deployed on another machine which uses another proxy, or if this client machine's proxy server changes, you'll encounter problems. Instead, let the clients configure the machine level proxy server.
    Lante, shanaolanxing This posting is provided "AS IS" with no warranties, and confers no rights.
    Windows Azure Technical Forum Support Team Blog
    Thursday, September 8, 2011 1:37 AM