views:

76

answers:

3

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

A: 

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.

Josh Stodola
I've tried that. When I try to add the reference I get an error and it shows me the error below. My line 1 isn't that one, guess I could run a substring on the directory to find it.Parser Error Message: Could not create type 'FormService.Service1'.Source Error: Line 1: <%@ WebService Language="VB" CodeBehind="FormService.asmx.vb" Class="FormService.Service1" %> Source File: /FormService.asmx Line: 1
Allen Stoner
Yes you need to update your reference! Don't you see the class name in here: `Class="FormService.Service1"`?
Josh Stodola
+2  A: 

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

jspru
How do I do that in VS2008 IDE?
Allen Stoner
Right click on the .svc file and click 'View markup", you need to change "Service1" in there to the name of your class.
jspru
Exactly what I was looking for. I knew it had to be around somewhere. Thanks for the help.
Allen Stoner
A: 

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.

Murph
I did change the class name to:Public Class JEBFormsServiceJust can't find where to change Class="....."
Allen Stoner
You've got it now, in FormsService.asmx - not FormService.asmx.cs
Murph