By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,313 Members | 1,360 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,313 IT Pros & Developers. It's quick & easy.

Simple WebService

P: n/a
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
--

Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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.

--
Manohar Kamath
Editor, .netBooks
www.dotnetbooks.com
"author" <no**@available.com> wrote in message
news:68********************************@4ax.com...
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
--

Nov 19 '05 #2

P: n/a
> 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
--
Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.