tags:

views:

145

answers:

3

Hi All,

I have written a wcf service which is working fine. On the client side i am using AddServiceReference feature of VS2008 to generate client proxy, it's also working fine. Now, for learning purpose i want to generate my client proxy with svcutil.exe tool but i am not able to use it, i have tried but don't know what is missing maybe i am missing some parameters, i know that AddServiceReference feature also uses svcutil.exe to generate proxy at client side.

Anyone please tell me how to use.

Actually my wcf service project is located at C:\Projects\WCFService and my client is at C:\Projects\WCFClient.

Below is my service class...

Uri address = new Uri("http://localhost:8090/MathServices/");

            using (ServiceHost host = new ServiceHost(typeof(MathOperations), address))
            {
                BasicHttpBinding binding = new BasicHttpBinding();
                host.AddServiceEndpoint(typeof(IMathOperations), binding, "");              

                ServiceMetadataBehavior metaDataBehavior = new ServiceMetadataBehavior();
                metaDataBehavior.HttpGetEnabled = true;
                host.Description.Behaviors.Add(metaDataBehavior);
                             host.Open();

            }
A: 

Use svcutil YourServiceUrl to generate the proxy class.

If your datacontract contains lists, use /ct:System.Collections.Generic.List1` or else the proxy class will have arrays instead of lists.

danish
A: 

Take a look at this video:

http://weblogs.asp.net/dwahlin/archive/2007/02/03/video-creating-a-service-with-windows-communication-service-wcf.aspx

It really helped me when I was creating a WCF service the 1st time. It includes everything from the beginning to the end, configuration, generation of proxy classes etc...

Juri
+1  A: 

We have found that it is better to use WCF without the autogenerated proxies.

Have a look at this video:

http://www.dnrtv.com/default.aspx?showNum=103

Note: This only works if you have control of both the server and the client side.

Shiraz Bhaiji
+1 I would also suggest looking at this video: http://www.dnrtv.com/default.aspx?showNum=122
Matt Davis