WCF


We can send WCF messages from a client application(application that consumes the WCF service) even without creating a proxy object.
For that, we can use the ChannelFactory.

If we have a contract called IMycontract and there is a message called MyMessage in the Contract with the channel IMyChannel, follow these steps to send the message without SVCUtil.exe.

ChannelFactory<IMyChannel> factory = new ChannelFactory<IMyChannel>(new BasicHttpBinding());
    IMyChannel channel = factory.CreateChannel(new EndpointAddress("http://10.10.10.10:2298/MyService/Service.svc"));
    channel.MyMessage (param1, param2);

You can include the headers as well. The IMyChannel is derieved from IMyContract and System.ServiceModel.IClientChannel.

If you a try to host a service in Windows Vista, you will receive an AddressAccessDeniedException. It is because of overly secured environment of the Windows Vista.

You will receive an error stating

HTTP could not register URL http://+:8000/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details).

You get this error because the owner of the http publishing is the built in administrator and you will not be running with administrator privileges.

You have to add the HTTP namespace to your user account. For that run the Command Prompt as an Administrator and run this command:

netsh http add urlacl url=http://+:8000/ user=DOMAIN\UserName 

You can more details here

Well, I got couple of websites where there are good number of videos for learning Windows Communication Foundation (WCF).

You can download them here at Mike Taulty’s Blog.

If you want webcasts for WCF then you can have them here.