Tuesday, September 22, 2009

How To: Add an .asmx Web Service Reference to a WCF Project in VS.NET

Recently I was developing a WCF service in VS.NET that needed to consume and make a call to a .asmx web service. Typically consuming a web reference from Visual Studio is as straight forward as right clicking the project in Solution Explorer and selecting 'Add Web Reference...'.

In my VS.NET 2008 WCF project there is only the option to 'Add Service Reference...'. So how do I add a .asmx web service? It is still easy to do to a WCF Service in VS.NET 2008, but it is a bit more hidden in the menus, so I will show you how to do it.

1st, right click the project and select 'Add Service Reference...' as displayed below:



2nd, click the 'Advanced' button in the bottom left-hand corner as displayed below:



3rd and lastly, click the 'Add Web Reference...' button in the bottom left-hand corner as displayed below:



At this point the more familiar 'Add Web Reference' window will be displayed where you can enter your .asmx URL and proceed to consuming the web reference to your WCF project.

1 comment:

  1. This post is absolutely fantastic. Thanks for sharing a lots of great information and inspiration, both of which we all need. Thank you so much!!
    create a website ecommerce

    ReplyDelete