Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. First web service on ASP.Net

First web service on ASP.Net

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-netwcfcom
15 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C CodingLover

    Hi all, I've start to learn web services. So I search a simple application and start work on it. http://support.microsoft.com/kb/308359[^] First of all I simply try to run the HelloWorld application. It compiled fine, but when I press the F5 to run the project gives an error message saying, Error while trying to run project; Unable to start debugging on the web server. Can someone tell me how to fix this. I'm wired with this. Thanks

    I appreciate your help all the time... CodingLover :)

    J Offline
    J Offline
    John Gathogo
    wrote on last edited by
    #2

    First, you need to ensure that you have <compilation debug="true"> ... </compilation> in the web.config. Secondly, if you are running VS on a Vista Operating System, do it as Administrator - Right click on the Visual Studio from Programs menu and click "Run as Administrator"

    C 1 Reply Last reply
    0
    • C CodingLover

      Hi all, I've start to learn web services. So I search a simple application and start work on it. http://support.microsoft.com/kb/308359[^] First of all I simply try to run the HelloWorld application. It compiled fine, but when I press the F5 to run the project gives an error message saying, Error while trying to run project; Unable to start debugging on the web server. Can someone tell me how to fix this. I'm wired with this. Thanks

      I appreciate your help all the time... CodingLover :)

      S Offline
      S Offline
      surender939
      wrote on last edited by
      #3

      You can not run a web service....... To test the web service you have to create one client application and need to refer this webservice Happy Programming

      C 1 Reply Last reply
      0
      • J John Gathogo

        First, you need to ensure that you have <compilation debug="true"> ... </compilation> in the web.config. Secondly, if you are running VS on a Vista Operating System, do it as Administrator - Right click on the Visual Studio from Programs menu and click "Run as Administrator"

        C Offline
        C Offline
        CodingLover
        wrote on last edited by
        #4

        Yes, it's set as true. I'm working on WinXP with .Net 2003 Still not working lol. Any idea. IIS also running.

        I appreciate your help all the time... CodingLover :)

        1 Reply Last reply
        0
        • S surender939

          You can not run a web service....... To test the web service you have to create one client application and need to refer this webservice Happy Programming

          C Offline
          C Offline
          CodingLover
          wrote on last edited by
          #5

          Can you guide me how to do it. And I'm confusing, on this. Once I create the project I see this. // WEB SERVICE EXAMPLE // The HelloWorld() example service returns the string Hello World // To build, uncomment the following lines then save and build the project // To test this web service, press F5 // [WebMethod] // public string HelloWorld() // { // return "Hello World"; // } What that mean.

          I appreciate your help all the time... CodingLover :)

          J 2 Replies Last reply
          0
          • C CodingLover

            Can you guide me how to do it. And I'm confusing, on this. Once I create the project I see this. // WEB SERVICE EXAMPLE // The HelloWorld() example service returns the string Hello World // To build, uncomment the following lines then save and build the project // To test this web service, press F5 // [WebMethod] // public string HelloWorld() // { // return "Hello World"; // } What that mean.

            I appreciate your help all the time... CodingLover :)

            J Offline
            J Offline
            John Gathogo
            wrote on last edited by
            #6

            Like surender939 said, a Web Service has to be consumed by a client. You should add a web (or window) project that consumes you web service. Add a project and add a web reference (to your web service). Then, you can call the HelloWorld() WebMethod. I dont know which book you might be using but I dont think an introductory web service example would be complete without a sample client.

            C 1 Reply Last reply
            0
            • J John Gathogo

              Like surender939 said, a Web Service has to be consumed by a client. You should add a web (or window) project that consumes you web service. Add a project and add a web reference (to your web service). Then, you can call the HelloWorld() WebMethod. I dont know which book you might be using but I dont think an introductory web service example would be complete without a sample client.

              C Offline
              C Offline
              CodingLover
              wrote on last edited by
              #7

              Actually I'm referring that MS page, link I post on my first post. I'll try what you suggest and if I stuck, be here again. :)

              I appreciate your help all the time... CodingLover :)

              J 1 Reply Last reply
              0
              • C CodingLover

                Can you guide me how to do it. And I'm confusing, on this. Once I create the project I see this. // WEB SERVICE EXAMPLE // The HelloWorld() example service returns the string Hello World // To build, uncomment the following lines then save and build the project // To test this web service, press F5 // [WebMethod] // public string HelloWorld() // { // return "Hello World"; // } What that mean.

                I appreciate your help all the time... CodingLover :)

                J Offline
                J Offline
                John Gathogo
                wrote on last edited by
                #8

                To give you a pointer, once you have added a Web Reference to your project, you can call the HelloWorld WebMethod, say from Page_Load, as follows:

                    protected void Page\_Load(object sender, EventArgs e)
                    {
                        localhost.Service1 hello = new localhost.Service1();
                        lblHello.Text = hello.HelloWorld();
                    }
                

                where, localhost is your Web reference name, lblHello is a label on your web form, and Service1 is the name of your web service

                C 1 Reply Last reply
                0
                • C CodingLover

                  Actually I'm referring that MS page, link I post on my first post. I'll try what you suggest and if I stuck, be here again. :)

                  I appreciate your help all the time... CodingLover :)

                  J Offline
                  J Offline
                  John Gathogo
                  wrote on last edited by
                  #9

                  I had a look at the link you quoted. The console application is the client. It should work. Make sure that your console project is the start up project. Right click on the project from Solution Explorer and click "Set as Startup Project".

                  C 1 Reply Last reply
                  0
                  • J John Gathogo

                    To give you a pointer, once you have added a Web Reference to your project, you can call the HelloWorld WebMethod, say from Page_Load, as follows:

                        protected void Page\_Load(object sender, EventArgs e)
                        {
                            localhost.Service1 hello = new localhost.Service1();
                            lblHello.Text = hello.HelloWorld();
                        }
                    

                    where, localhost is your Web reference name, lblHello is a label on your web form, and Service1 is the name of your web service

                    C Offline
                    C Offline
                    CodingLover
                    wrote on last edited by
                    #10

                    Thanks a lot. Before that I want to know one thing. Now I have two project in my solution, a web application and a web service. How can I add a reference to the web service in the web application. And how I add your code there.

                    I appreciate your help all the time... CodingLover :)

                    J 1 Reply Last reply
                    0
                    • J John Gathogo

                      I had a look at the link you quoted. The console application is the client. It should work. Make sure that your console project is the start up project. Right click on the project from Solution Explorer and click "Set as Startup Project".

                      C Offline
                      C Offline
                      CodingLover
                      wrote on last edited by
                      #11

                      Actually in my solution I have only one project, web service project. Actually I don't know, until you guys mentioned it, that a web service need a web application to start work.

                      I appreciate your help all the time... CodingLover :)

                      1 Reply Last reply
                      0
                      • C CodingLover

                        Thanks a lot. Before that I want to know one thing. Now I have two project in my solution, a web application and a web service. How can I add a reference to the web service in the web application. And how I add your code there.

                        I appreciate your help all the time... CodingLover :)

                        J Offline
                        J Offline
                        John Gathogo
                        wrote on last edited by
                        #12

                        Just right-click on the project (Web Application) from Solution Explorer, click on Add Web Reference. You will get a dialog box. Under a label: [Browse to:] click [Web services in this solution]. VS will discover all the web services in your solution and they will be presented in a list. Click on the one you want to use and, after giving it an appropriate web reference name add it (VS might suggest something like 'localhost'). You will then be ready to go. You can add the sample code on the Page_Load of a web form in your web application.

                        C 2 Replies Last reply
                        0
                        • J John Gathogo

                          Just right-click on the project (Web Application) from Solution Explorer, click on Add Web Reference. You will get a dialog box. Under a label: [Browse to:] click [Web services in this solution]. VS will discover all the web services in your solution and they will be presented in a list. Click on the one you want to use and, after giving it an appropriate web reference name add it (VS might suggest something like 'localhost'). You will then be ready to go. You can add the sample code on the Page_Load of a web form in your web application.

                          C Offline
                          C Offline
                          CodingLover
                          wrote on last edited by
                          #13

                          Thanks lol, I'll try and let you know what happen in my side. :)

                          I appreciate your help all the time... CodingLover :)

                          1 Reply Last reply
                          0
                          • J John Gathogo

                            Just right-click on the project (Web Application) from Solution Explorer, click on Add Web Reference. You will get a dialog box. Under a label: [Browse to:] click [Web services in this solution]. VS will discover all the web services in your solution and they will be presented in a list. Click on the one you want to use and, after giving it an appropriate web reference name add it (VS might suggest something like 'localhost'). You will then be ready to go. You can add the sample code on the Page_Load of a web form in your web application.

                            C Offline
                            C Offline
                            CodingLover
                            wrote on last edited by
                            #14

                            Ok, As you said I add reference into the web application of the web service. I can build the solution fine, but I cannot run it. How can I run the web application? Please help me.

                            I appreciate your help all the time... CodingLover :)

                            C 1 Reply Last reply
                            0
                            • C CodingLover

                              Ok, As you said I add reference into the web application of the web service. I can build the solution fine, but I cannot run it. How can I run the web application? Please help me.

                              I appreciate your help all the time... CodingLover :)

                              C Offline
                              C Offline
                              CodingLover
                              wrote on last edited by
                              #15

                              Wow, nice work lol. I've figured what the mistake I've done. Seems to me using the IDE, just pressing F5, cannot run the web application. I have to type the URL and run the browser. It's working fine. Is that right lol.

                              I appreciate your help all the time... CodingLover :)

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups