(AXIOS GET)
我要求.net core web api 2.1
使用本机反应,但我在控制台上得到的错误如下:
注意: Cors 被授予权限.net core 2.1
。
代码:
return axios.get('http://127.0.0.1:50000/api/values', {
credentials: 'include'
})
.then(
(response) => {
console.log(response);
}
)
.catch(
(error) => {
console.log(error);
}
);
错误:
Error: Network Error
at createError (D:\Projeler\Mobile\ReactNative\primCepte\node_modules\axios\lib\core\createError.js:16)
at XMLHttpRequest.handleError (D:\Projeler\Mobile\ReactNative\primCepte\node_modules\axios\lib\adapters\xhr.js:87)
at XMLHttpRequest.dispatchEvent (D:\Projeler\Mobile\ReactNative\primCepte\node_modules\event-target-shim\lib\event-target.js:172)
at XMLHttpRequest.setReadyState (D:\Projeler\Mobile\ReactNative\primCepte\node_modules\react-native\Libraries\Network\XMLHttpRequest.js:580)
at XMLHttpRequest.__didCompleteResponse (D:\Projeler\Mobile\ReactNative\primCepte\node_modules\react-native\Libraries\Network\XMLHttpRequest.js:394)
at D:\Projeler\Mobile\ReactNative\primCepte\node_modules\react-native\Libraries\Network\XMLHttpRequest.js:507
at RCTDeviceEventEmitter.emit (D:\Projeler\Mobile\ReactNative\primCepte\node_modules\react-native\Libraries\vendor\emitter\EventEmitter.js:190)
at MessageQueue.__callFunction (D:\Projeler\Mobile\ReactNative\primCepte\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:349)
at D:\Projeler\Mobile\ReactNative\primCepte\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:106
at MessageQueue.__guard (D:\Projeler\Mobile\ReactNative\primCepte\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:297)