I created a web method but when i go to the site and type for example http://mysite.com/services/Amounts/GetAmount it returns an error Internal Server Error 500. After investigating the issue in event logs etc,, it says GetAmount invalid method name. but i know the mame is fine
[WebMethod(EnableSession=true)]
public string GetAmount(Amounts amts)
{
//some logic here to add to the database.
}
What are the possible issues that I have to look into when this type of error shows?, I checked all the references and everything is named properly “GetAmount”.
What are you trying to do here? You need to post more code and
web.config. Which version of .NET you are using here? All this information may get you the better answer.Firstly, your URL
http://example.org/services/Amounts/GetAmountdoes not seems to be correct – there has to be.asmxsomewhere unless you are using ASP.NET routing or some url rewriting.Assuming that your routing/re-writing is indeed working correctly:
in general, if its a normal SOAP Web Service then enable HTTP get –
If you are trying create a service callable from script (ScriptService) then for asmx service, you need to mark the method as
ScriptServiceand you may need to adjust web.config based on your .NET version. Also you need to enable HTTP GET – for example,You may also need to adjust Response Format whether you want JSON or XML.