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

  • SEARCH
  • Home
  • 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 7733833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:05:51+00:00 2026-06-01T07:05:51+00:00

I have a asp.net asmx service and i would like to convert it to

  • 0

I have a asp.net asmx service and i would like to convert it to a wcf service.

I’m having problems calling the wcf service from jquery ajax POST request with parameters.

if i call the WCF service without parameters or pass the parameter in a json format it works OK.

When executing the below jquery post to the wcf service i get error 500.

Please note , i cannot change the way the jquery request is made.

Original ASMX Service:

[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public void SendStatus(string param1, string param2)
{
..................
}

jQuery POST:

var d = { param1: 1, param2: 2 };
        $.ajax({
            type: "POST",
            url: "/Service1.asmx/SendStatus",
            data: d,
            success: function () { }
        });

NEW WCF Service:

[OperationContract]
[WebInvoke]

public void SendStatus(string param1, string param2)
{
}

jQuery POST:

var d = { param1: 1, param2: 2 };
 $.ajax({
            type: "POST",
            url: "/Service2.svc/SendStatus",
            data: d,
            success: function () { }
        });
  • 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-06-01T07:05:53+00:00Added an answer on June 1, 2026 at 7:05 am

    — EDIT —
    I recall this issue drove me nuts once before, so I went back for another look. Sure enough … Given the requirement that the Javscript remain as written, I maintain that this is literally impossible with the current release of WCF. Consider the following points:

    1) You need to use webHttpBinding, because that’s the only binding that supports REST style services (basicHttpBinding and WSHttpBinding both use SOAP wrappers). (ref. here: BasicHttpBinding vs WsHttpBinding vs WebHttpBinding)

    2) The AJAX call as written in this question uses a content-type of “application/x-www-form-urlencoded” (you can confirm this using Fiddler).

    3) You can also confirm that WCF throws an exception before the service method even gets invoked. The exception is as follows:

    The body style ‘Bare’ is not supported by ‘WebScriptEnablingBehavior’. Change the body style to be ‘WrappedRequest’.

    But “bare” body style is Microsoft-speak for a REST request using basic parameters (ie, not “wrapped” in JSON or XML). That is, there is no possible configuration that would allow WCF to handle this specific AJAX request. You can even implement your own WebContentTypeMapper, and it still won’t work. This guy is on to them: http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2473190-consider-making-the-system-servicemodel-channels-r

    My conclusion is that (given you can’t use MVC, which would make this a piece of cake), you need to somehow route this request to a basic .ASPX page, and use the trusty old Webforms methods (Page.IsPostBack, Request.Params[“param1”], etc).

    — END EDIT —

    Per the other thread above, looks like there are a few parameters you need to add/fix in your AJAX call:

    ...
    dataType: 'json',
    contentType: 'application/json; charset=utf-8',
    data: JSON.stringify(d)
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an ASMX web service which we invoke from our ASP.NET application using
I have an ASP.NET web service (.asmx). My service is defined like the following:
I have an ASP.NET (.asmx) Web Service project that has a method like: public
I have a jquery ajax call asp.net web service question. I want to validate
I have an ASP.Net 3.5 application in which I would like to setup some
I've written an ASP.NET webservice (.asmx style rather than WCF) and I have the
I have am asp.net 3.5 web site with a asmx web service and a
I have hosted a web service that gets called from an ASP.NET 1.1 by
I have an ASP.net webforms site, using jQuery to trigger script methods in asmx
I have a ASP.NET web service ( .asmx ) with methods that receives int

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.