CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2005
    Location
    Maryland,USA
    Posts
    20

    Web Service asmx problem

    hi all,

    When I create a ASP.Net Web Service project in visual studio,it creates an asmx and asmx.cs(code-behind) by default apart from some other files.

    The class inside asmx.cs inherits from System.Web.Services.Service.But if i make changes to the class to inherit from my custom class(clsCustom) instead of System.Web.Services.Service,the designer view(asmx file) throws an exception saying 'could not create an instance of the class clsCustom'.

    Anybody has any idea?Thanks in advance.

    CafeDreamz.

  2. #2
    Join Date
    Apr 2004
    Posts
    6

    Re: Web Service asmx problem

    Since .NET CLR allows only single-inheritance, you need to have your custom class to inherit from System.Web.Services.Service and the code-behind class to inherit from that custom class

  3. #3
    Join Date
    Mar 2005
    Location
    Chicago, IL
    Posts
    69

    Re: Web Service asmx problem

    If you do not want any UI objects in your web service u dont have to derive from System.Web.Services.WebService. if you do not derive from this class the web service designer is of no use.

    Try deriving your custom class from System.Web.Services.WebService, the designer should load correctly.
    There has been an alarming increase in the number of things I know nothing about .

  4. #4
    Join Date
    Jun 2005
    Location
    Maryland,USA
    Posts
    20

    Re: Web Service asmx problem

    My custom class is deriving from System.web.Services.WebService.But still the designer doesnt work.Any ideas?

    Thanks in advance.

    CafeDreamz

  5. #5
    Join Date
    May 2003
    Location
    Germany
    Posts
    936

    Re: Web Service asmx problem

    The designer needs an parameterless public constructor for displaying.
    Useful or not? Rate my posting. Thanks.

  6. #6
    Join Date
    Jun 2005
    Location
    Maryland,USA
    Posts
    20

    Re: Web Service asmx problem

    There is a paramterless contructor.The problem is that the designer is not able to recognise my custom class like it does the built in classes(like System.Web.Services.WebService).Maybe I need to place the assembly containing my custom class in the GAC or some other location for the designer to recognise it.Any ideas?

    Thanks.

    CafeDreamz.

  7. #7
    Join Date
    Mar 2005
    Location
    Chicago, IL
    Posts
    69

    Re: Web Service asmx problem

    Identify the code generated by the studio in the asmx.cs . Copy the same into the custom class that you have and u will be good to go.

    There has been an alarming increase in the number of things I know nothing about .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured