开发者

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.开发者_JAVA技巧web

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

Thank you!


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.


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


Make sure the .dll of what you are publishing is not in the GAC. I had a similar problem and spent days trying to figure it out. Turns out it was in the GAC and a simple gacutil /q /f and a recycle of the app pool fixed it.


The proper way to do this is by right clicking on the App_WebReferences folder in your client ASP.NET project and choosing the option to “Update Web/Service References”. This will cause the IDE to go and grab the latest version of the back-end web service definition file.

When you right click on the App_WebReferences folder and update the web references, you are essentially updating the definition for all of the web services that your ASP.NET application is using. This means that if you had references to several different web services, it will go to each and every one of them to get an updated set of definitions. This may not be necessary in some situations where you just want to update ONE web service definition (i.e. the one that you know has changed).


Right click in your service in solution explorer and update web service. I have checked.


One of the things which tricked me and did not see my changes in WSDL- that I have multiple instances of Visual studio opened with different versions of the same solution and it was picking the old version from a different instance.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜