Tips and Tricks in a world of Mix

Posts tagged ‘Windows Authentication’

Changing Wcf from Anonymous to Windows Authentication – server and client basicHttpBinding sample

This solution has been developed for Intranet and doesn’t take in concert security issues of Internet

I got some client using the Windows Auth but the wcf could read the

So  I had to turn the Windows Auth for wcf also.

The Wcf couldn’t show the services through the new Authentication until I didn’t change the mexHttpBinding to the basicHttpBinding

Server Side :

<binding name="MyBasicHttp" allowCookies="true"
<readerQuotas maxDepth="2147483647" 

<!--<security mode="TransportCredentialOnly">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
<service name="Egged.Tnua.Wcf.ServiceImpl.EventService" 
<endpoint address="" 
binding="basicHttpBinding" bindingConfiguration="MyBasicHttp"
contract="My.Wcf.IServiceImpl.IEventService" />
<!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />-->
<endpoint address="mex" binding="basicHttpBinding" contract="IMetadataExchange" bindingConfiguration="MyBasicHttp" />


Client Side

        <binding name="BasicHttpBinding_IMyService"
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" />
      <endpoint address="http://localhost/MyWcfPublishedName/MyServiceEndpoint.svc"
            name="BasicHttpBinding_IMyService" />
</client>   </system.serviceModel>

Very important – in client in order that the binding would be activated on the endpoint you ought to add its name 

to bindingConfiguration and Name

It’s getting very importnat when there is a lot of data going through and the default binding just isn’t enough.


Mvc with Windows Authentication results – /login.aspx?ReturnUrl=%2f – solution

When first published on server the MVC  has been Anonymous. then changed to windows Authentication caused

The resource cannot be found.

The url has been the standart need one but – /login.aspx?ReturnUrl=%2fEgged.Tnua.TimeTable%2fHome

The solution is :

adding the following lines to the AppSettings section of my web.config file in appSettings:

<add key="autoFormsAuthentication" value="false" />
<add key="enableSimpleMembership" value="false"/>

Weirdly enough – solved the problem!

Found it here

Tag Cloud

%d bloggers like this: