No username specified. Enter username in ClientCredentials

I create a WCF application with client credentials. It works fine inside, while I am referencing and calling this service from another project, I received an error message.

The username is not provided. Specify username in ClientCredentials. 

Please help me solve this problem.

 <bindings> <wsHttpBinding> <binding name="WSHttpBinding_IWcfService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> <security mode="TransportWithMessageCredential"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" negotiateServiceCredential="true" algorithmSuite="Default" /> </security> </binding> </wsHttpBinding> </bindings> <client> <endpoint address="https://wcfauthtest.sbs.in:448/WcfService.svc/WcfService.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IWcfService" contract="AuthTest.IWcfService" name="WSHttpBinding_IWcfService"> <identity> <dns value="localhost" /> </identity> </endpoint> </client> 

Any help?

+7
c # web-services wcf
source share
1 answer

You have specified credentials on the client / consumer side:

 WcfService.UserName.UserName = "user"; WcfService.UserName.Password = "pass"; 

You must provide these credentials before calling the WCF service in your code.

+4
source share

All Articles