Tips and Tricks in a world of Mix

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
ServiceSecurityContext.Current.PrimaryIdentity

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 :

<bindings>
<basicHttpBinding>
<binding name="MyBasicHttp" allowCookies="true"
maxReceivedMessageSize="2147483647"
maxBufferPoolSize="2147483647"
maxBufferSize="2147483647"
openTimeout="10:00"
>
<readerQuotas maxDepth="2147483647" 
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647"/>

<!--<security mode="TransportCredentialOnly">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>-->
</security>
</binding>
</basicHttpBinding>
</bindings>
.
.
.
<services>
<service name="Egged.Tnua.Wcf.ServiceImpl.EventService" 
behaviorConfiguration="DefaultBehavior">
<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" />
</service>

 

Client Side

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IMyService"
                  openTimeout="00:10:00"
                   sendTimeout="00:10:00"
                  allowCookies="true"
                  bypassProxyOnLocal="false"
                  maxBufferPoolSize="200000000"
                  maxReceivedMessageSize="200000000">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
</basicHttpBinding>
    </bindings>
    <client>
 
      <endpoint address="http://localhost/MyWcfPublishedName/MyServiceEndpoint.svc"
             binding="basicHttpBinding"
             bindingConfiguration="BasicHttpBinding_IMyService"
             contract="MyService.IMyService"
            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.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Tag Cloud

%d bloggers like this: