Allen Stoner
Allen Stoner

Reputation: 365

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 to find this?

Allen

Upvotes: 0

Views: 7072

Answers (4)

chaithra
chaithra

Reputation: 11

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)

Upvotes: 1

Murph
Murph

Reputation: 10190

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.

Upvotes: 0

jspru
jspru

Reputation: 1019

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

Upvotes: 3

Josh Stodola
Josh Stodola

Reputation: 82513

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.

Upvotes: 0

Related Questions