Click here to Skip to main content
15,904,817 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I am trying to call the HelloWorld method that is created by visual studio when you create a new asmx web service.

I have added the *.asmx.cs file to the App_Code folder of the test site and the .asmx file to the sites root. If I go to testserver/Service1.asmx I see the page that list the services methods.

If I try testserver/Service1.asmx/HelloWorld I get an error. How can I get the service running or call the HelloWorld method.

I have spent two and a half days googling, reading and watching videos trying to figure I out what I need to do or what I am doing wrong.
Posted
Comments
What is that error?

1 solution

The service is running, you're just not accessing it correctly.

You're probably getting an error like: Request format is unrecognized for URL unexpectedly ending in '/HelloWorld'.

Web services don't (necessarily) behave like regular web pages do. For example, when you navigate to a web page your browser is performing a GET request.

The Hello World web service goes not allow GET requests. If you go to http://localhost:8801/Service1.asmx?op=HelloWorld (change the port to whatever port your service is running on) you will get a page like this:

<img src="http://www.codeproject.com/script/Membership/Uploads/1740717/Screenshot_2014-06-12_12.01.53.png" width="600" />

It shows you three different ways to interact with your web service.

If you click the Invoke button, your browser will perform a POST request, which is what the web service is expecting.

I recommend using Fiddler[^] to construct queries that you can send to a web server, and see the raw response.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900