Note that there are some explanatory texts on larger screens.

plurals
  1. POWCF Authentication problem
    primarykey
    data
    text
    <p>I have a big problem with custom user name authentication in WCF. I've made a simple WCF Service which needs users validation via CustomUserValidator. When I log-in from Console Application like this:</p> <pre><code>using (var svc = new ServiceReference2.DBServiceClient()) { Console.WriteLine("Username: "); string user = Console.ReadLine(); Console.WriteLine("Pass: "); string pass = Console.ReadLine(); svc.ClientCredentials.UserName.UserName=user; svc.ClientCredentials.UserName.Password=pass; Console.WriteLine(svc.GetAllDepartmentList().First().DepartmentID); Console.Read(); } </code></pre> <p>Everything is fine, but when I want to use my GUI Client which essentialy do the same I've got an error: Outer Exception:</p> <blockquote> <p>Secure channel cannot be opened because security negotiation with the remote endpoint has failed. This may be due to absent or incorrectly specified EndpointIdentity in the EndpointAddress used to create the channel. Please verify the EndpointIdentity specified or implied by the EndpointAddress correctly identifies the remote endpoint.</p> </blockquote> <p>Inner Exception:</p> <blockquote> <p>The request for security token has invalid or malformed elements.</p> </blockquote> <p>The app.config entry for both of them is identical:</p> <pre><code>&lt;system.serviceModel&gt; &lt;bindings&gt; &lt;wsHttpBinding&gt; &lt;binding name="WSHttpBinding_IDBService" 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"&gt; &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt; &lt;reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /&gt; &lt;security mode="Message"&gt; &lt;transport clientCredentialType="Windows" proxyCredentialType="None" realm="" /&gt; &lt;message clientCredentialType="UserName" negotiateServiceCredential="true" algorithmSuite="Default" /&gt; &lt;/security&gt; &lt;/binding&gt; &lt;/wsHttpBinding&gt; &lt;/bindings&gt; &lt;client&gt; &lt;endpoint name="WSHttpBinding_IDBService" address="http://localhost:8732/Design_Time_Addresses/DBService/Service1/" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IDBService" contract="ServiceReference2.IDBService" &gt; &lt;identity&gt; &lt;dns value="localhost" /&gt; &lt;/identity&gt; &lt;/endpoint&gt; &lt;/client&gt; &lt;/system.serviceModel&gt; </code></pre> <p>Thanks for all your help!</p> <p>Edit: posting GUI code in which I catch an exception:</p> <pre><code> using (var svc = new DBServiceHost.DBServiceClient()) { svc.ClientCredentials.UserName.UserName = view.userName; svc.ClientCredentials.UserName.Password = view.userPass; int asd = svc.GetCompanies().First().CompanyID; } </code></pre> <p>This assigment to int is just to get this exception in this place.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload