I'm trying to use the ClientApp.sln project, but I've some problem with the proxy authentication and I dont' find any documentation about it: can you help me? I would like to know how i can set proxy server, username and password. Thanks in advance
@angelo.palumbo
I found a solution on stack overflow.
void SetProxySettings<TChannel>(ClientBase<TChannel> client, bool useProxy, string address, int port, string login, string password) where TChannel : class{ if (!useProxy) return; var b = client.Endpoint.Binding as BasicHttpBinding; if (b == null) { System.Diagnostics.Debug.WriteLine("Binding of this endpoint is not BasicHttpBinding"); return; } b.ProxyAddress = new Uri(string.Format("http://{0}:{1}", address, port)); b.UseDefaultWebProxy = false; // !!! b.Security.Mode = BasicHttpSecurityMode.Transport; b.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; // !!! b.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Basic; // !!! if (client.ClientCredentials == null) return; client.ClientCredentials.UserName.UserName = login; client.ClientCredentials.UserName.Password = password;}
For example:
using (var dsClient = new DSServiceClient()) { // Issue a call to get the token SetProxySettings(dsClient, true, "127.0.0.1", 8080, "admin", "password");...
Hello @angelo.palumbo
The problem seems be be how to configure the proxy in Visual Studio application to run DataStream ClientApp demo and connects to DataStream Web Service from your company network.
I strongly suggest you contact your IT Network team to help you on setting proxy . You can find more detail regarding how to configure the proxy in Visual Studio from this post.
Thanks for your solution. In configuration.svcinfo file there are some keys about proxy argument, I thought there was a directly callable method.