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 6942879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:04:58+00:00 2026-05-27T13:04:58+00:00

I have an web service named AEWService.asmx with the following code: using System; using

  • 0

I have an web service named AEWService.asmx with the following code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace editor
{
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    public class AEWService : System.Web.Services.WebService
    {
        [WebMethod]
        public static Dictionary<string, string> TestFunc(string elementToBeModified, string selectedValue)
        {
            Dictionary<string, string> newValues = new Dictionary<string, string>();
            newValues.Add("k1", "val1");
            newValues.Add("k2", "val2");
            return newValues;
        }
    }
}

When I call the webmethod with ajax, I get a 500 error – Unknown web method TestFunc. The ajax call looks like this:

var dataString = JSON.stringify({ 
    "elementToBeModified": "someElement", 
    "selectedValue": "someValue"
});
$.ajax({
  url: 'AEWService.asmx/TestFunc',
  type: "POST",
  data: dataString,
  contentType: "application/json; charset=utf-8",
  dataType: "json",
  success: function (data) {
     // do somethig...
  }
});

I also added the following lines into web.config under tags (I’m not sure what they mean but I hope they are ok):

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

The code worked perfect when the webmethod was on a aspx page. What’s wrong with the asmx?

Thanks!

  • 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-27T13:04:59+00:00Added an answer on May 27, 2026 at 1:04 pm

    You can not return a dictionary object from webservice.
    See this post. http://forums.asp.net/t/1370858.aspx/1

    Also don’t mark the webmethod as static. Check here
    Why are Static Methods not Usable as Web Service Operations in ASMX Web Services?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have developed a web servcies in my local system with name (inbox service).
I have a web service (ASMX) and in it, a web method that does
I have a Web service set up using Zend_Soap, and some public methods in
I have a CXF JAX-WS web service operation named diagnosticPing that accepts two params,
I have used this command to send xml files to a web service named
I have this stadard code for receiving a class from a web service: function
I have web service, which use integrated security in IIS. Now, I want to
When I call, the service's method, I have Web Service Exception happening which I
I have a web-service that I will be deploying to dev, staging and production.
I have a web service that I created in C# and a test harness

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.