Simple WebService

A

author

Newbie Q...

When I hit the "ws.asmx" in a browser, I get
"Parser Error Message: Could not create type 'Service1'" ??

If I use the file "ws_ok.asmx" (without codebehind, but same code), I
get no errors.

Any 1 ??

TIA


-- ws.asmx --
<%@ WebService Language="vb" Codebehind="ws.vb" Class="Service1" %>
--


-- ws.vb --
Imports System
Imports System.Web
Imports System.Web.Services

<WebService(Namespace:="http://127.0.0.1/ws/")> _
Public Class Service1
Inherits WebService

<WebMethod()> _
Public Function Add(ByVal a As Integer, ByVal b As Integer) As
Integer
Return a + b
End Function

End Class
--


-- ws_ok.asmx --
<%@ WebService Language="vb" Class="Service1" %>

Imports System
Imports System.Web
Imports System.Web.Services

<WebService(Namespace:="http://127.0.0.1/ws/")> _
Public Class Service1
Inherits WebService

<WebMethod()> _
Public Function Add(ByVal a As Integer, ByVal b As Integer) As
Integer
Return a + b
End Function

End Class
--
 
M

Manohar Kamath

You should compile the project first before you can start using it. During
this, all the code-behind pages are compiled into a binary file in the bin
folder. This file contains all the code-behind classes you use in your ASMX
file. Since you probably did not do this, you are receiving this error.
 
A

author

You should compile the project first before you can start using it.

Ahh.. okey. So I just can't do it like I do with my
aspx-codebehind-files ?? - only if I put it all in the asmx-file ??


mypage.aspx
--
<%@ Page Language="vb" Inherits="mypage" Src="mypage.vb" %>
--

mypage.vb
--
Imports ....

Public Class mypage
Inherits page

Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs)
End Sub
End Class
--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top