简体   繁体   中英

this operation requires iis integrated pipeline mode

I have ajax call on my aspx page as:

 $.ajax({
                    url: "/SiteAdmin3/UpsIntegration.aspx/addUpdatePackageData",
                    data: JSON.stringify({
                        '_OrderNumber': $("#txtOrderNumber").val(),
                        '_PackageNumber': $("#lblPackageNumber").html(),
                        '_Height': $("#txtPackageHeight").val(),
                        '_Width': $("#txtPackageWidth").val(),
                        '_Lenght': $("#txtPackageLenght").val(),
                        '_Weight': $("#txtPackageWeight").val(),
                        '_ReferanceNumber1': $("#txtPackageReferanceNumber1").val(),
                        '_ReferanceNumber2': $("#txtPackageReferanceNumber2").val(),
                        '_ReferanceNumber3': $("#txtPackageReferanceNumber3").val(),
                        '_ReferanceNumber4': $("#txtPackageReferanceNumber4").val(),
                        '_ReferanceNumber5': $("#txtPackageReferanceNumber5").val(),
                        '_PackageType': $("#ddlAddPackageType").val()
                    }),
                    contentType: 'application/json;',
                    dataType: "json",
                    type: 'POST',
                    cache: false,
                    success: function (Data) {

//whatever operation to be performed
},
                    error: function (err) {
                        alert("Error in Saving.Please try later." + JSON.stringify(err));
                    }
                });

On cs page my addUpdatePackageData method is:

[WebMethod()]
    public static ShipStationIntegration[] addUpdatePackageData(string _OrderNumber, string _PackageNumber, string _Height, string _Width, string _Lenght, string _Weight, string _ReferanceNumber1, string _ReferanceNumber2, string _ReferanceNumber3, string _ReferanceNumber4, string _ReferanceNumber5, string _PackageType)
    {
        System.Collections.Generic.List<ShipStationIntegration> lst = new List<ShipStationIntegration>();
        try
        {
            lst = bindPackageListFromPageMethod();



            return lst.ToArray();
        }
        catch (Exception)
        {

            return lst.ToArray();
        }

    }

This returns correct list.

Butafter getting responce it always goes in error block of ajax as and gives error as:

在此处输入图片说明

I am not understanding what is wrong in it?

I also tried with:

contentType: 'application/json; charset=utf-8',

But still error was there.

Please help me.

If you are using the VS 2010 integrated web server (Cassini), it does not support Integrated Pipeline mode. You'll need to download IIS Express and set your project to use it instead.

When your return from a webmethod and the response format should be JSON the response pass to a httpModule that serialize the response into JSON and try to execute Response.Headers.Add("Content-type", "application/json"); BUT this way to add http headers are not supported by Cassini because this way needs Integrated Pipeline mode and as @Kevin says:

Cassini does not support Integrated Pipeline

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM