Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Additional method in webservice not showing up

I wrote a ASP.NET web service that has 2 methods. These run fine and are shown in http://localhost:85/Services/NopService.asmx?WSDL

If I add another method, I cannot access the new one!

The according file is in D:\Web\NopCommerceStore\Services\NopService.asmx and ..asmx.cs No other file of that name anywhere!

If I simply add another method like:

[WebMethod]
public string Hi(string you)
{
    return "Hi " + you;
}

and navigate to http://localhost:85/Services/NopService.asmx?WSDL the new method does not show up - even after: Restart IIS Clear temp.asp.net folder clear hash.web

How can I update my web service with a new method??

Thank you!

like image 800
Sale Avatar asked Dec 16 '22 13:12

Sale


2 Answers

If you've copied the .asmx file from another project, be sure to change the namespace in both the codebehind file AND the markup (right click the .asmx file and choose "View Markup").

Otherwise, the markup file will have a Class attribute that points to the previous project. And if that previous project still exists on your system, its methods will be referenced regardless of what you have done in your new codebehind file.

like image 67
JCDrumKing Avatar answered Jan 03 '23 04:01

JCDrumKing


recompile your web service code then update its reference inside the project call it.

like image 27
Amir Ismail Avatar answered Jan 03 '23 04:01

Amir Ismail