Problem adding existing Webservice to a Web Application Project

Last post 10-30-2008 10:15 PM by mrmercury. 16 replies.

Sort Posts:

  • Problem adding existing Webservice to a Web Application Project

    10-30-2008, 5:35 PM
    • Member
      9 point Member
    • vikaskolluri
    • Member since 05-06-2008, 11:15 AM
    • Hyderabad
    • Posts 66

    Hello,

    I am trying to add a existing Web service to my application but after adding the Web service to my Web Application project, when I hit F5, I get the following error:

    Error 24 Could not create type 'AutoComplete'. C:\Inetpub\wwwroot\bacardi\AutoComplete.asmx 1 

    Thanks,

    VK

    DotNetPrince
    Filed under:
  • Re: Problem adding existing Webservice to a Web Application Project

    10-30-2008, 7:22 PM
    • Contributor
      5,082 point Contributor
    • mrmercury
    • Member since 04-04-2006, 2:26 PM
    • Mexico City, Mexico
    • Posts 739
    Since you are adding an existing WebService the full name could be wrong, check the .asmx file to see if the <@ WebService> tag has the correct name.
    If this post helped you please remember to set it as Answer so it can help others.
  • Re: Problem adding existing Webservice to a Web Application Project

    10-30-2008, 7:31 PM

    Is the existing service built, up and running? Can you access it through a browser?

    John Saunders
  • Re: Problem adding existing Webservice to a Web Application Project

    10-30-2008, 7:43 PM
    • Member
      9 point Member
    • vikaskolluri
    • Member since 05-06-2008, 11:15 AM
    • Hyderabad
    • Posts 66

    Hi,

    My web service tag is given below:

      <%@ WebService Language="C#" CodeBehind="~/Test.cs" Class="Test" %>

     I could see that in every page, the page directive is Inherits = "<projectdll>.<pagename>. Does this has to do some thing with the problem. any ideas???

    DotNetPrince
  • Re: Problem adding existing Webservice to a Web Application Project

    10-30-2008, 7:49 PM
    • Contributor
      5,082 point Contributor
    • mrmercury
    • Member since 04-04-2006, 2:26 PM
    • Mexico City, Mexico
    • Posts 739
    I think you have a problem with the classes’ names, from you first post the WebService seems to be named AutoComplete, but in your codebehind file it’s named Test.
    If this post helped you please remember to set it as Answer so it can help others.
  • Re: Problem adding existing Webservice to a Web Application Project

    10-30-2008, 7:49 PM

    Are the web service and the Web Application Project in the same solution?

    What version of Visual Studio are you using, and what edition (Express, Professional, etc.)

    Have you done a full build of the web service? Can you access the web service URL through a browser?

    John Saunders
  • Re: Problem adding existing Webservice to a Web Application Project

    10-30-2008, 7:54 PM
    • Member
      9 point Member
    • vikaskolluri
    • Member since 05-06-2008, 11:15 AM
    • Hyderabad
    • Posts 66

     

    Are the web service and the Web Application Project in the same solution?

    Yes, they are in the same solution.

    What version of Visual Studio are you using, and what edition (Express, Professional, etc.)

    VS2005 Team Edition for Software Developers with SP1 Installed.

    Have you done a full build of the web service? Can you access the web service URL through a browser?

    I could not build the page cos when I hit F5, it pops up with the error "Could not create type test"

    The web service test is the one I have created to test whether any new web service added to the WAP works or not.

    DotNetPrince
  • Re: Problem adding existing Webservice to a Web Application Project

    10-30-2008, 7:58 PM
    • Member
      9 point Member
    • vikaskolluri
    • Member since 05-06-2008, 11:15 AM
    • Hyderabad
    • Posts 66

     To be more specific about my case. I have a web application project which is converted from VS2003. The solution was compiled/built on a different computer and sent to me. Please note that the virtual directory is created under c:\inetpub\wwwroot. On my computer VS.NET is installed on D drive and so I copied the files to c:\inetpub\wwwroot folder and opened in my vs.net. I have added new aspx pages to the project and made lot of changes to it. Everything executes fine. But not this web service I created. Hope this helps.

    DotNetPrince
  • Re: Problem adding existing Webservice to a Web Application Project

    10-30-2008, 7:58 PM
    • Member
      9 point Member
    • vikaskolluri
    • Member since 05-06-2008, 11:15 AM
    • Hyderabad
    • Posts 66

     

    Are the web service and the Web Application Project in the same solution?

    Yes, they are in the same solution.

    What version of Visual Studio are you using, and what edition (Express, Professional, etc.)

    VS2005 Team Edition for Software Developers with SP1 Installed.

    Have you done a full build of the web service? Can you access the web service URL through a browser?

    I could not build the page cos when I hit F5, it pops up with the error "Could not create type test"

    The web service test is the one I have created to test whether any new web service added to the WAP works or not.

    DotNetPrince
  • Re: Problem adding existing Webservice to a Web Application Project

    10-30-2008, 8:01 PM
    • Contributor
      5,082 point Contributor
    • mrmercury
    • Member since 04-04-2006, 2:26 PM
    • Mexico City, Mexico
    • Posts 739

    Try changing the tag to:

    <%@ WebService Language="C#" CodeBehind="~/AutoComplete.cs" Class="AutoComplete" %>

     Since that seems to be the name of the .asmx file.

    If this post helped you please remember to set it as Answer so it can help others.
  • Re: Problem adding existing Webservice to a Web Application Project

    10-30-2008, 8:05 PM
    • Member
      9 point Member
    • vikaskolluri
    • Member since 05-06-2008, 11:15 AM
    • Hyderabad
    • Posts 66

    the name of the existing web service I am planning to use is AutoComplete. The webservice tag in that file is:

    <%@ WebService Language="C#" CodeBehind="~/AutoComplete.cs" Class="AutoComplete" %>

    Since, that didnt work out, I created a new web service called test. tag is as follows:

     <%@ WebService Language="C#" CodeBehind="~/Test.cs" Class="Test" %>

    both of them didnt work in my case.. Pls advise..

    DotNetPrince
  • Re: Problem adding existing Webservice to a Web Application Project

    10-30-2008, 8:09 PM

    Forget about F5. Right-click the web service project and choose "Rebuild". Then try F5.

     And have you ever tried accessing the service from a browser like I asked?

    John Saunders
  • Re: Problem adding existing Webservice to a Web Application Project

    10-30-2008, 8:24 PM
    • Member
      9 point Member
    • vikaskolluri
    • Member since 05-06-2008, 11:15 AM
    • Hyderabad
    • Posts 66

     When I hit rebuild, again the same error. Could not create type test. While trying out on this. I have created one Web service application separately and tried to include all the methods in the existing web service and its created successfully now. I want to include this web service application in my project. I did the following steps:

    Right click on my WAP solution > add existing project, browsed the project and added the project in my app. How do I use the web service application methods in my .aspx pages??

    DotNetPrince
  • Re: Problem adding existing Webservice to a Web Application Project

    10-30-2008, 8:36 PM
    • Member
      9 point Member
    • vikaskolluri
    • Member since 05-06-2008, 11:15 AM
    • Hyderabad
    • Posts 66

     missed your question in the previous post:

    I have tried to access the web service in browser and I still get the same error. 

    As I said, I have created one Web service application from 

    File> New > Project> ASP.NET Web Services Application , I have successfully created and can run and get the data using the web service. I have added that to my solution. Can u pls advise on how to consume that web service in my Web Application Project.. Thanks for all your help..

    DotNetPrince
  • Re: Problem adding existing Webservice to a Web Application Project

    10-30-2008, 8:54 PM

    Have you added a web reference to the service? Right-click your WAP and use "Add Web Reference".

    Also, let's please stop saying "when I hit F5". The effect of F5 can differ depending on what you have selected. Instead, let's start right-clicking on projects and using "Debug->Start new instance".

    John Saunders
Page 1 of 2 (17 items) 1 2 Next >