I am trying to create a WCF host/client combination using mixed security with
UserName authentication.
Everything looks good on the host side, but when I go to generate the client
proxy using the VS 2005 "Add Service Reference" wizard it generates a proxy
class that, while correct in all respects for my service, doesn't seem to
have any knowledge of security credentials.
I'm looking to be able to do something like:
proxy.ClientCredentials.UserName.UserName = "name";
but neither the proxy generate nor the additions to my app.config seem to
recognize the security choices I've made in the web.config of my host.
The servicemodel portion of my web.config is below. Any ideas?
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MyBehavior">
<serviceDebug includeExceptionDetailInFaults="false"/>
<serviceCredentials> <userNameAuthentication
userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="MyValidator, App_code"/>
</serviceCredentials>
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MyBehavior" name="MyInterface">
<endpoint binding="wsHttpBinding" name="wsHttpWithUsername"
contract="IMyInterface"/>
<endpoint address="mex" binding="mexHttpBinding"
name="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="wsHttpWithUsername">
<security mode="TransportWithMessageCredential" >
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
Thanks in advance!
Ed