Adding a Web Reference to a VS 2008 Windows Forms Project


First, we will see how to add a web service in VS2005, and then we will see what changed in VS2008 orcas.


In Visual 2005 (Whidbey), adding a Web Reference is pretty straight forward.

From Project -> Add Web Reference ..., (From Solution Explorer, Right Click on Project, From the drop down Menu, Select Add Web Reference)

Add Web Reference Dialog Comes up.

In the Text box for URL, you specify url for the Web Service.

Click Go

Then a preview of the service is shown.  You have the option of renaming the service.

Click the "Add Reference ..." Button.

Web Service is added to the solution.  You can see it under "Web References"

What Changed in Orcas

From Project -> Add Service Reference ..., (From Solution Explorer, Right Click on Project, From the drop down Menu, Select Add Service Reference)

Click Advanced Button


Service Reference Setting Dialog Comes up. Click "Web Reference" button here.   Web Reference dialog comes up. The rest of the steps are same as in VS2005







Comments (13)
  1. In this post, I describe how to create a WebService that returns a DataSet, deploying the web service,

  2. on3 says:

    is that possible to create the web reference with lines of code?

  3. Lisa says:

    Thank you!  It was making me CRAZY that I couldn’t find the Add Web Reference button!

  4. Neha says:

    It saved me tons of time trying to find how I can add a web reference in VS 2008. Thanks a lot!

  5. Malik says:

    when i want to add a web reference in Vs 2008 i always have this message:

    The XML page cannot be displayed

    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.


    A name was started with an invalid character. Error processing resource ‘http://localhost/FlyRight/FlyRight/FlightInfo.asmx

    <%@ WebService Language="VB" CodeBehind="FlightInfo.asmx.vb" Class="FlyRight.Service1" %>


  6. Pranav says:

    Thanks a ton for this article. I went crazy searching for this.

  7. steve says:

    Is there a reason that it’s buried now?

    It seems that Web References are being phased out, based on the fact that you can add one only as an advanced "compatibility" option…

    So is it preferred practice now to use a Service Reference as opposed to a Web Reference?

    What’s the difference between the two?

    thanks –

    – steve

  8. ks says:

    Thank u !!! actually i m searching for Add Web Reference  option

  9. John Dunagan says:

    Awesome, Naga. Thanks – I spent six hours trying to figure out how to do this. And now stuff works. You rock.

  10. pooja says:

    When i was trying to add a web reference, it says none though i had two web methods in my web service.

    None – No Web services were found in the current solution.

    Can you help me quickly?

  11. srikanth says:

    I was trying to add a web reference in the website which was added to the webservice. The error that was popping out is

    Server Error in ‘/’ Application.


    Parser Error

    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

    Parser Error Message: Could not create type ‘CustOrderService.CustOrderService’.

    Source Error:

    Line 1:  <%@ WebService Language="C#" CodeBehind="CustOrderService.asmx.cs" Class="CustOrderService.CustOrderService" %>

    Source File: /CustOrderService.asmx    Line: 1


    Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

    How to resolve this?

  12. Dharmesh Shah says:

    Thanks for this article, this has got me on the right track.

Comments are closed.

Skip to main content