views:

154

answers:

2
+1  Q: 

WCF configuration

Hi,

We hosted WCF services with basicHttpBinding on server side,

    <bindings>           
      <basicHttpBinding>        
        <binding name="BasicHttpEndpointBinding" >
          <security  mode="TransportCredentialOnly">
            <transport  clientCredentialType="basic" /> 
          </security>          
        </binding>        
      </basicHttpBinding>      
    </bindings>

WCF services hosted in Windows xp sp3 , IIS 5.1 with Anonymous access enabled.
If I want to access the WCF services on .net 2.0 desktop application.
What configuration do I need do, with sample code?

thanks
nrk

A: 

Assuming that you can install .NET 3.0 (as per the discussion connected to your question), you can use WCF on the client side as well, and you would need to use the same binding configuration as the one you posted.

Mark Seemann
A: 

If you cannot install .NET 3.0 (which is the first .NET to contain the WCF bits), all you can do is add a reference to this service as an ASMX web service.

In Visual Studio, go to your project, and right-click and pick "Add Web Reference" and type in the URL.

There's no other way to do it (with nothing but .NET 2.0).

If you can upgrade to .NET 3.0, then your client app.config will have this exact same section inside it:

<bindings>           
      <basicHttpBinding>        
        <binding name="BasicHttpEndpointBinding" >
          <security  mode="TransportCredentialOnly">
            <transport  clientCredentialType="basic" /> 
          </security>          
        </binding>        
      </basicHttpBinding>      
    </bindings>

but you've not shown us the more interesting part of your server config file - the <services> section that defines the endpoints your service has to offer.

On the client, you'll have at a mimimum:

<client>
  <endpoint name="whatever"
            address="http://yourServer:8080/YourService/"
            binding="basicHttpBinding"
            bindingConfiguration="BasicHttpEndpointBinding"
            contract="IYourServiceContract" />
</client>

That should do it.

marc_s
Thanks Marc_s, I will try..
nRk