3

我已经在我的 WEB API 项目中启用了 Cors!API 控制器中的所有其他方法都可以从其他项目访问!

但剑道上传器请求无法到达控制器方法

 $("#files").kendoUpload({
            async: {
                xhrFields: {
                    withCredentials: true
                },
                saveUrl: 'http://localhost:23618/API/test/UploadAttachment',

                removeUrl: 'http://localhost:23618/API/test/RemoveAttachment',
                autoUpload: true
            },

            upload: function (e) {
                e.data = { contactID: 5 };
            },

            error: onError

        });

错误

A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin 'http://localhost:23617' is therefore not allowed access.

这是我的科尔

 var cors = new EnableCorsAttribute("*", "*", "*");
            config.EnableCors(cors);
4

1 回答 1

11

以这种方式尝试对我有用.. http://docs.telerik.com/KENDO-UI/api/javascript/ui/upload#configuration-async.withCredentials

$("#files").kendoUpload({
            multiple: false,
            async: {
                withCredentials: false,
                saveUrl: "url",
                autoUpload: true
            },
            success: onSuccess
        });

于 2015-10-26T19:34:25.373 回答