Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7691765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:41:54+00:00 2026-05-31T20:41:54+00:00

I found some other questions about this, but they didn’t work for me :(

  • 0

I found some other questions about this, but they didn’t work for me 🙁 So I’m posting my own question:

I’ve made an ASP.NET webservice in mono. The code for it is:

using System;
using System.Web;
using System.Web.Services;

namespace testWebservice
{
    public class ws : System.Web.Services.WebService
    {
        public ws() {

        }
        [WebMethod]
        public String sendCar()
        {
            return "44.435006,26.102314";
        }
    }
}

I’m trying to call this webservice from a website using jQuery:

function getCar()
{
    $.ajax( {
    type:'POST',
    url:'http://127.0.0.1:8080/ws.asmx/sendCar',
    contentType: "application/json; charset=utf-8",  
    data: "{}",
    dataType: "json",
    success:function(msg) {
      AjaxSucceeded(msg);  
    },  
    error: AjaxFailed
    })   
    function AjaxSucceeded(result) {   
              alert(result.d);   
          }  
    function AjaxFailed(result) {   
              alert(result.status + ' ' + result.statusText);   
          }         
}   

When I run the page I get an alert saying “0 error”.
Cay anyone give me some advice please?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:41:55+00:00Added an answer on May 31, 2026 at 8:41 pm

    For the service to work you need to:

    Add to your project a reference to System.Web.Extension.

    Add a using System.Web.Script.Services; to your ws source.

    Add:

    [ScriptService]
    

    to your ws class.

    Add:

        <remove verb="*" path="*.asmx"/>
        <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    

    inside your web.config under the <httpHandlers> tag.

    If you are calling getCar() from a button click add return false; after the method call so that the click will not cause a postback.

    For example:

    [Default.aspx]

    <%@ Page Language="C#" Inherits="testWebservice.Default" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <head runat="server">
        <title>jQuery Web Service call from Mono using JSON</title>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
        <script type="text/javascript">
            function getCar()
            {
                $.ajax( {
                type:'POST',
                url:'http://127.0.0.1:8080/ws.asmx/sendCar',
                contentType: "application/json; charset=utf-8",  
                data: "{}",
                dataType: "json",
                success:function(msg) {
                  AjaxSucceeded(msg);  
                },  
                error: AjaxFailed
                })   
                function AjaxSucceeded(result) {   
                          alert(result.d);   
                      }  
                function AjaxFailed(result) {   
                          alert(result.status + ' ' + result.statusText);   
                      } 
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:Button runat="server" id="btnTest" Text="Call WebService" OnClientClick="getCar(); return false;" />
        </form>
    </body>
    </html>
    

    [ws.asmx.cs]

    using System;
    using System.Web;
    using System.Web.Script.Services;
    using System.Web.Services;
    
    namespace testWebservice
    {
        [ScriptService]
        public class ws : System.Web.Services.WebService
        {
            public ws() {
    
            }
            [WebMethod]
            public String sendCar()
            {
                return "44.435006,26.102314";
            }
        }
    }
    

    [web.config]

    <?xml version="1.0"?>
    <!--
    Web.config file for testWebservice.
    
    The settings that can be used in this file are documented at 
    http://www.mono-project.com/Config_system.web and 
    http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
    -->
    <configuration>
      <system.web>
        <compilation defaultLanguage="C#" debug="true">
          <assemblies>
            <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
          </assemblies>
        </compilation>
        <customErrors mode="RemoteOnly">
        </customErrors>
        <authentication mode="None">
        </authentication>
        <authorization>
          <allow users="*" />
        </authorization>
        <httpHandlers>
            <remove verb="*" path="*.asmx"/>
            <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        </httpHandlers>
        <trace enabled="false" localOnly="true" pageOutput="false" requestLimit="10" traceMode="SortByTime" />
        <sessionState mode="InProc" cookieless="false" timeout="20" />
        <globalization requestEncoding="utf-8" responseEncoding="utf-8" />
        <pages>
        </pages>
      </system.web>
    </configuration>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found a bunch of other questions about this topic, but for some reason
I saw some other similar questions on this topic here but they were not
I still have some confusion about this thing. What I have found till now
I tried to research this, but there were still some questions left unanswered. I
This is my second question about this topic, the original question can be found
There are already some questions about dependency managers here, but it seems to me
I was answering some quiz questions for an interview, and the question was about
I found an interesting question about retransmission queue on TCP, I've been reading this
I have checked few other posts and found some UIAnimation transitions that kind-of give
I was debugging a stored procedure the other day and found some logic something

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.