In your client application config, make sure you've setup your binding along the following lines...
<bindings>
<basicHttpBinding>
<binding name="MyBinding" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="true" hostNameComparisonMode="StrongWildcard"
maxBufferSize="1000000" maxBufferPoolSize="524288" maxReceivedMessageSize="1000000"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
Then you can specifiy your endpoints to use the binding config
<client>
<endpoint address="http://SomeDomain/SomeApp/SomeService.svc"
binding="basicHttpBinding" bindingConfiguration="MyBinding"
contract="MyApp.Contracts.ISomeService" name="ISomeService_Endpoint" />
</client>
And endpoint behaviours...
<behaviors>
<endpointBehaviors>
<behavior name="clientEndpointCredential">
<clientCredentials>
<windows allowNtlm="true" allowedImpersonationLevel="None" />
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
In your WCF service client (ClientBase<t>) make sure you've initialised your credentials...I use a little wrapper class to help with this and communication faults.
public class WCFServiceClient<t> : ClientBase<t>,
IDisposable where T : class
{
#region ctors
public WCFServiceClient()
{
this.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
this.ClientCredentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;
}
public WCFServiceClient(string endpointConfigurationName) :
base(endpointConfigurationName)
{
}
public WCFServiceClient(string endpointConfigurationName, string remoteAddress) :
base(endpointConfigurationName, remoteAddress)
{
}
public WCFServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
base(endpointConfigurationName, remoteAddress)
{
}
public WCFServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress)
{
}
#endregion ctors
void IDisposable.Dispose()
{
if (State == CommunicationState.Faulted)
{
Abort();
}
else
{
try
{
Close();
}
catch
{
Abort();
}
}
}
}
</t></t>
Your client service classes can just inherit from this + implement whatever service interface you have defined
My srticle
Visual Application Launcher[
^] uses a similar approach to the above & has worked OK.