Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

91
Views
How to Post BLOB data to asp.net webservice with ajax

I'm trying to post blob files to the web service, I couldn't find any solution. What I've tried so far is;

my ajax is;

            var model = new FormData();
            model.append("blob", blob);

            $.ajax({
                type: "POST",
                url: "../CreatePhoto",
                data: model,
                async: false,
                contentType: false,
                processData: false,
                success: function (data) {
                    if (data.d == true) {

                    } else {

                    }

                },
                error: function (e) {
                    console.log(e);
                }
            });

      

And my CreatePhoto.asmx.cs web service is;

 [WebMethod(EnableSession = true)]
 public bool CreatePhoto(HttpPostedFileBase blob){.....}

The problem is, when I try to trigger the ajax function, I'm getting this error on chrome logs;

 System.InvalidOperationException: CreatePhoto Web Service method name is not valid. 
at System.Web.Services.Protocols.HttpServerProtocol.Initialize()

I'm using a classic asp.net web application and my web service is also created with asp.net. There is plenty solution with MVC but, I'm trying to achieve this with asp.net.

ps: i'm able to trigger every other web services under the same URL.

7 months ago ยท Juan Pablo Isaza
Answer question
Find remote jobs