我已经在我的 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);