Webservice .ASMX file not found error

Last post 11-05-2009 3:49 PM by TimBue. 16 replies.

Sort Posts:

  • Webservice .ASMX file not found error

    11-02-2009, 2:59 AM
    • Member
      10 point Member
    • TimBue
    • Member since 06-07-2008, 4:27 PM
    • Posts 102

    Hello,

    I have created a simple webservice in VS 2005.  I added a cascadingdropdownlist extender in an update panel, as well as a single drop down list, and a scriptmanager.  When copy and paste the name of the asmx file including the asmx extension, and paste it into the property of the service path, it comes up saying it cannot find the service, even thought the web service is there.  The codebehind in VB includes a simple webmethod function which returns the datarow values and names for each row specified by the dataset's tableadapter method. 


    I tried, adding a new webservice to the root, and that has not worked.

    I also made sure the scriptingservice decoration was listed right about the class.

    I also have tried closing and reopening Visual studio to no luck,

    I have also checked to make sure the webconfig file has the appropriate tags in place as well.

    Finally, I have rebuilt the project, however the servicepath attribute still cannot find the webservicefile specified.


  • Re: Webservice .ASMX file not found error

    11-02-2009, 3:54 AM
    • Star
      8,892 point Star
    • integrasol
    • Member since 06-05-2009, 11:18 AM
    • Denmark & Spain
    • Posts 1,657

    Okay, I think showing us some code and markup will make us better able to help you. Are you able to add a Web reference to the Web service, if deployed to IIS, and use it directly within your project?

    Thanks

    Carsten

    Please click Mark as Answer if this post is of help to you. :-)



    My Blog
  • Re: Webservice .ASMX file not found error

    11-02-2009, 11:26 AM
    • Star
      13,663 point Star
    • gt1329a
    • Member since 06-24-2002, 12:53 AM
    • Atlanta
    • Posts 2,252
    • ASPInsiders
      TrustedFriends-MVPs

    One common fix is to use a virtual root path (e.g. ~/WebService.asmx), to avoid any trouble caused by the virtual path that projects add locally by default.

    Without seeing some code, it's hard to give further advice.

    Encosia - ASP.NET, jQuery, AJAX, and more.

    Latest article: Emulate ASP.NET validation groups with jQuery validation
  • Re: Webservice .ASMX file not found error

    11-02-2009, 12:41 PM
    • Member
      10 point Member
    • TimBue
    • Member since 06-07-2008, 4:27 PM
    • Posts 102

    Here is some sample code, "~/" was able to fix the error in not finding the webservice,  However I am now getting a 500 error instead of the results of the dataset.


    VS 2005 Professional

    The ASP.NET page code

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="SearchDefault.aspx.vb"  EnableEventValidation="false" MasterPageFile="~/masterpages/pubMaster.master" Inherits="DataDetailsTest" %>

    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>


    <asp:Content ID="cntDetailsViewTest" ContentPlaceHolderID="webformcontent" Runat="Server">
        &nbsp;<br />
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="upControlSearch" runat="server">
            <ContentTemplate>
                &nbsp;<asp:Label ID="lblSelIndustry" runat="server" Text="Industry : "></asp:Label>
                <br />
                <br />
                <br />
                <asp:DropDownList ID="ddlIndustry" runat="server">
                </asp:DropDownList><br />
                <br />
                <br />
                <br />
                <cc1:CascadingDropDown ID="cddIndustry" runat="server" Category="Industry" LoadingText="Loading Industries ..."
                    PromptText="Select an Industry" ServiceMethod="GetDDIndustries" TargetControlID="ddlIndustry" ServicePath="~/GetReferralService.asmx">
                </cc1:CascadingDropDown>
                &nbsp;&nbsp;&nbsp;&nbsp;<br />
                <br />
                <asp:Label ID="lblSelCompany" runat="server" Text="Category  :"></asp:Label><br />
                <br />
                <br />
                &nbsp;
            </ContentTemplate>
        </asp:UpdatePanel>
        <br />
        &nbsp;<br />
        <br />


    </asp:Content>


    Codebehind:

    Imports System.Web
    Imports System.Web.Services
    Imports System.Web.Services.Protocols
    Imports AjaxControlToolkit
    Imports System.Data.SqlClient
    Imports System.Data
    Imports System.Collections.Generic

    <WebService(Namespace:="http://tempuri.org/")> _
    <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
    <System.Web.Script.Services.ScriptService()> _
    Public Class GetReferralService
        Inherits System.Web.Services.WebService

        <WebMethod()> _
          Public Function GetDDIndustries(ByVal knownIndustryValues As String, ByVal industry As String) As CascadingDropDownNameValue()

            Dim industryAdapter As New dsRefbyIndustryTableAdapters.dsIndustryTableAdapter

            Dim industryValues As New List(Of CascadingDropDownNameValue)()

            For Each Row As DataRow In industryAdapter.GetIndustries
                industryValues.Add(New CascadingDropDownNameValue(Row("Ind_Name").ToString, Row("Ind_IndustryID").ToString))
            Next

            Return industryValues.ToArray
        End Function

     End Class

  • Re: Webservice .ASMX file not found error

    11-02-2009, 12:48 PM
    • Star
      13,663 point Star
    • gt1329a
    • Member since 06-24-2002, 12:53 AM
    • Atlanta
    • Posts 2,252
    • ASPInsiders
      TrustedFriends-MVPs

    What's the specific 500 error?  That will give you details about what's going wrong on the server-side.

    Encosia - ASP.NET, jQuery, AJAX, and more.

    Latest article: Emulate ASP.NET validation groups with jQuery validation
  • Re: Webservice .ASMX file not found error

    11-02-2009, 1:08 PM
    • Member
      10 point Member
    • TimBue
    • Member since 06-07-2008, 4:27 PM
    • Posts 102

    the specific error is Method Error 500

  • Re: Webservice .ASMX file not found error

    11-02-2009, 10:08 PM
    • Star
      13,663 point Star
    • gt1329a
    • Member since 06-24-2002, 12:53 AM
    • Atlanta
    • Posts 2,252
    • ASPInsiders
      TrustedFriends-MVPs

    Make sure you're running in debug mode.  If you look at the content of the 500 error's response, there should be a lot of detail about the error.  It will be the same information as you see on a regular yellow screen error.

    That, or just run the site in debug mode through Visual Studio, so you can inspect the server-side error at runtime.

    Encosia - ASP.NET, jQuery, AJAX, and more.

    Latest article: Emulate ASP.NET validation groups with jQuery validation
  • Re: Webservice .ASMX file not found error

    11-02-2009, 10:23 PM
    • Member
      10 point Member
    • TimBue
    • Member since 06-07-2008, 4:27 PM
    • Posts 102

    This is the exact error:


    [InvalidOperationException: Request format is unrecognized for URL unexpectedly ending in '/GetDDIndustries'
    .]
       System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context
    , HttpRequest request, HttpResponse response) +405961
       System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb
    , String url, String filePath) +212
       System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType
    , String url, String pathTranslated) +47
       System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path
    , String pathTranslated, Boolean useAppConfig) +193
       System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +93
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) 
    +155
  • Re: Webservice .ASMX file not found error

    11-03-2009, 12:36 AM
    • Star
      13,663 point Star
    • gt1329a
    • Member since 06-24-2002, 12:53 AM
    • Atlanta
    • Posts 2,252
    • ASPInsiders
      TrustedFriends-MVPs
  • Re: Webservice .ASMX file not found error

    11-03-2009, 1:38 AM
    • Member
      10 point Member
    • TimBue
    • Member since 06-07-2008, 4:27 PM
    • Posts 102

    I tried this solution, and put the recommended code into the config file, but the same error still results in the drop down box, as well as the same specific error, in debug mode.

  • Re: Webservice .ASMX file not found error

    11-03-2009, 1:48 AM
    • Star
      13,663 point Star
    • gt1329a
    • Member since 06-24-2002, 12:53 AM
    • Atlanta
    • Posts 2,252
    • ASPInsiders
      TrustedFriends-MVPs

    Which version of ASP.NET is the service running on?

    How is it hosted?  IIS 6, IIS 7, the VS web development server?

    Encosia - ASP.NET, jQuery, AJAX, and more.

    Latest article: Emulate ASP.NET validation groups with jQuery validation
  • Re: Webservice .ASMX file not found error

    11-03-2009, 2:24 AM
    • Member
      10 point Member
    • TimBue
    • Member since 06-07-2008, 4:27 PM
    • Posts 102

    right now it is running on my local machine, the ASP.net version 2.0.50727, and the IIS is 5.1 on XP Pro.  I run the program through the run button, in order to receive this error.

  • Re: Webservice .ASMX file not found error

    11-03-2009, 2:50 AM
    • Star
      13,663 point Star
    • gt1329a
    • Member since 06-24-2002, 12:53 AM
    • Atlanta
    • Posts 2,252
    • ASPInsiders
      TrustedFriends-MVPs

    Do you know whether your site is targeting 2.0 or 3.5?  IIS reports version 2.0.50727 for both (because they both run on the 2.0 CLR).

    One problem you could be having is that 3.5 doesn't work on IIS 5.  Does it work if you run it under the Visual Studio development server?

    If it's 2.0, make sure you have the ASP.NET AJAX Extensions 1.0 installed and that your web.config has all of these entries in it.

    Encosia - ASP.NET, jQuery, AJAX, and more.

    Latest article: Emulate ASP.NET validation groups with jQuery validation
  • Re: Webservice .ASMX file not found error

    11-03-2009, 2:23 PM
    • Member
      10 point Member
    • TimBue
    • Member since 06-07-2008, 4:27 PM
    • Posts 102

    From what I know, I believe I am running on ASP.Net 2.0.  I am using VS Professional 2005, and am not sure if that has the development server, or how to test it on that. 

  • Re: Webservice .ASMX file not found error

    11-03-2009, 10:03 PM
    • Star
      13,663 point Star
    • gt1329a
    • Member since 06-24-2002, 12:53 AM
    • Atlanta
    • Posts 2,252
    • ASPInsiders
      TrustedFriends-MVPs

    If you're running Visual Studio 2005, then it should definitely be an ASP.NET 2.0 project.

    Have you double checked that the ASP.NET AJAX Extensions are installed and that your web.config has all of the necessary additions?  I wouldn't think you'd get this far without the extensions installed, but you could be missing the HttpHandlers and/or HttpModules section of the web.config and have issues like this.

    To test in the development server, go to the "web" tab in your project's properties and select it from the "servers" section in the lower half of that tab.  You can switch between them there anytime you want.

    Encosia - ASP.NET, jQuery, AJAX, and more.

    Latest article: Emulate ASP.NET validation groups with jQuery validation
Page 1 of 2 (17 items) 1 2 Next >