views:

181

answers:

2

I'm trying to set up a .NET 3.5 web service project in Visual Studio. My goal is to include a namespace in this web service that I can expose to web applications that references this web service.

As you can see below, I have added the namespace "MyWebservices", but I am not able to find it after referencing the web service.

Service1.asmx.vb

Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel

Namespace MyWebservices

 ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
 ' <System.Web.Script.Services.ScriptService()> _
 <System.Web.Services.WebService(Namespace:="http://tempuri.org/")&gt; _
 <System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
 <ToolboxItem(False)> _
 Public Class Service1
  Inherits System.Web.Services.WebService

  <WebMethod()> _
  Public Function HelloWorld() As String
   Return "Hello World"
  End Function

 End Class
End Namespace

Service1.asmx

<%@ WebService Language="VB" CodeBehind="Service1.asmx.vb" Class="WebService1.MyWebservices.Service1" %>

Note: I have also attempted to modify the "Root Namespace" property of the web service project, but I can't get that to work for me either.

A: 

I think the class attribute of your asmx file header is wrong. Should be "MyWebservices.Service1" not "WebService1.MyWebservices.Service1"

Yoenhofen
If I take out the "WebService1" part I get a parser error. "Could not create type 'MyWebservices.Service1'."
Kikuchiyosesa
A: 

use 'Class=MyWebServices.Webservices1.Service1, MyWebServices.Webservices1' when using a namespace.

Rob Crfewson