Error while creating a web service - Could not create type 'Service'.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SwapnilD
    New Member
    • Jan 2010
    • 41

    #1

    Error while creating a web service - Could not create type 'Service'.

    I'm creating a webservice in vb.net version 2.0 on my local machine, deploying it to v1.1 on development server and getting an error "Could not create type 'Service'." Below is the code snippet that I wrote to create a web service

    - Service.asmx file
    Code:
    <%@ WebService Language="vb" CodeBehind="~/App_Code/Service.vb" Class="Service"%>
    - Service.vb file in "App_Code" folder
    Code:
    WebService(Namespace:="http://www.abc.com/Service")> _
    <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
    Public Class Service
        Inherits System.Web.Services.WebService : Implements IHttpHandler
    
        <WebMethod()> _
       Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
            Dim files As HttpFileCollection = context.Request.Files
            Dim parameters As NameValueCollection = context.Request.Params
            Dim UserKey = parameters("userKey")
            Dim message = parameters("message")
            Dim listenToLink = parameters("listen")
            Dim CreateDate = parameters("CreationDate")
    			
        End Sub
        Public ReadOnly Property IsReusable() As Boolean Implements System.Web.IHttpHandler.IsReusable
            Get
                Return True
            End Get
        End Property
    End Class
    While deploying this web service to the online development server I copied the App_Code(along with Service.vb file) file to the root directory of source code and copied Service.asmx file to the root directory and tried to run the web service in a below mentioned way (URL is just for example it is not actual URL of my site)

    http://www.abc.com/service.asmx

    after executing the above mentioned URL I'm getting errror
    Code:
    Parser Error Message: Could not create type 'Service'.
    
    Source Error: 
    
    
    Line 1:  <%@ WebService Language="vb" 
    CodeBehind="~/App_Code/Service.vb" Class="Service"%>
    .

    Please note that, I CANT CHANGE ASP.NET Version from 1.1 to 2.0.

    Any help will be greatly appreciated,

    Please review and provide good solution.

    Thanks in advance

    Swapnil
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    You can specify which framework to target in your BUILD using Visual Studio though :)

    -Frinny

    Comment

    Working...