Last post Sep 18, 2014 06:27 AM by l.laxmikant
Sep 12, 2014 03:29 AM|mou_inn|LINK
i do not want to add service ref rather i want to create proxy at runtime. if i know service url then can i create proxy at runtime and call the wcf service. thanks
Sep 12, 2014 09:05 AM|XIII|LINK
if you have the service interface you could make use of the ChannelFactory class for this:
An alternative approach would be to make use of Web API instead.
Sep 15, 2014 03:31 AM|mou_inn|LINK
thanks for giving me the link but i was looking for guide line like that wcf client always need to create proxy first and then client can consume the service. for creating proxy we use VS IDE add service reference option and svcutil etc but i want that client
will not add service ref or will not use svcutil to create proxy rather i want a approach by which client can invoke service and create proxy at run time.
i just do not understand that how channel factory does the job. looking for details discussion.
Sep 15, 2014 05:42 AM|XIII|LINK
i want a approach by which client can invoke service and create proxy at run time.
Before opening that box I suggest you take a look at Web API instead as an alternative.
Sep 17, 2014 06:28 AM|l.laxmikant|LINK
you can use ChannelFactory to create proxies dynamically
Sep 17, 2014 06:50 AM|mou_inn|LINK
the link u gave and from there i came to know this way we can create proxy using channel factory.......but i have one issue
just see the code and u will notice that they use icatory interface but how client can have the ICatory interface definition ? suppose client knows only our service url then how client can create proxy ? looking for suggestion. thanks
public static Category GetCategoryDetails(int categoryID)
Category category = new Category();
WSHttpBinding myBinding = new WSHttpBinding();
EndpointAddress myEndpoint = new
= new ChannelFactory<ICategoryService>(myBinding, myEndpoint);
ICategoryService instance = myChannelFactory.CreateChannel();
category = instance.GetCategoryDetails(categoryID);
Sep 17, 2014 07:35 AM|XIII|LINK
they use icatory interface but how client can have the ICatory interface definition ?
The way this can be done is that you have a class library with the interfaces. You implement it on the WCF service side and copy the same class library assembly in your project which is going to call the WCF service.
Another one would be to make use of ws-discovery like explained in
http://msdn.microsoft.com/en-us/library/dd456791%28v=vs.110%29.aspx. However apparently it's slower.
If you really want to have no dependency then you will be interested in Web API.
Basically why do you want to do this kind of discovery?
Sep 17, 2014 11:15 AM|mou_inn|LINK
out of curiosity i am trying to know.
Sep 18, 2014 06:27 AM|l.laxmikant|LINK
as mentioned in the previous link you have to create a separate assembly for contracts which is accessible to client and service both
go through the below link which describes how to share ServiceContracts