开发者

Changing name of web service class after created

I wrote a quick and dirty web service in VB.NET. And as it always goes, I want to move it to production, but don't want to use the name Service1 for the public class. When I change the name I get an error when trying to reference it. I know there is somewhere else I need to change the class name, something in the code behind but I can't find where it is. Does anyone have any ideas where开发者_C百科 to find this?

Allen


Look in the designer file for the service, you may need to change it in there as well.


In visual studio 2008 when u add webservice ref and when you click on service1.asmx it does not show you the "<%@ WebService Language="C#" CodeBehind="service1.asmx.cs" Class=".service1" %>" instead it goes to code view.

search for 'codebehind" in your solution and you will see service1.asmx file opened and change the Class in the above tag to Namespace.Mywebservice(or as desired)


You can change the name of it, no problem. You just need to update your reference to the service. In my experience, sometimes it takes the IDE a little time to reflect the changes made to a local web service.


From your comment, this is the problem (in FormService.asmx):

Class="FormService.Service1"

You need to change Service1 to your new service name.

To explain a bit, the asmx page is making a class reference to your service code, this is how the front end page and the back end code behind are wired together (even though we don't really think in terms of services having "pages") - its the same as for pages and user controls.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜