WCF Channel construct performance issue
I have a strange situation, and I hope someone has experienced this scenario, and can help me.
I have a WCF service hosted on IIS. From one client (Windows XP Pro SP3), a simple call takes less than a second, but from another client (also win xp pro sp3 but must be with another config somehow), it takes 7 seconds to make the first call in the application.
What I do in the app, is instanciating the service, and making a simple call. I have tried to do diagnostics. When I look at the client service log, I can see that the construct of the channel takes about 2 seconds. Open Client base takes about 2 seconds and running the method in the service takes about 2 seconds.
Then I close the service.
If I make the call again, it take 0 seconds, l开发者_运维技巧ike on the other machine. If I close the application, the first run takes 7 seconds again.
From the slow PC calls to ASMX service on the same IIS allways run fast, but I want to use WCF.
I use basic IIS authentication, and I am adding credentials runtime with the code below. But I do the same thing, on both PC's, so... I must be configuration somehow.
MyServiceClient client = new MyServiceClient();
ClientCredentials loginCredentials = new ClientCredentials();
loginCredentials.UserName.UserName = "theuser";
loginCredentials.UserName.Password = "thepass";
var defaultCredentials = client.Endpoint.Behaviors.Find<ClientCredentials>();
client.Endpoint.Behaviors.Remove(defaultCredentials); //remove default ones
client.Endpoint.Behaviors.Add(loginCredentials); //add required ones
client.Endpoint.Address = new System.ServiceModel.EndpointAddress(GetSVCUrl());
client.InnerChannel.OperationTimeout = new TimeSpan(0, 0, 60);
client.Endpoint.Binding.OpenTimeout = new TimeSpan(0, 0, 60);
Configuration is set with
<security mode="TransportCredentialsOnly">
<transport clientCredentialType="Basic" realm="" />
</security>
I have googled a lot on the issue and have tried different configsettings related to proxy etc, but without any real breakthrough.
I hope someone can give me a hint in the right direction.
Thanks!
Morten, Denmark
精彩评论