I'm using ReactJS with functional components for my front-end trying to fetch data from the ASP.NET WebService,
from File.jsx
const URL = 'http://localhost:63579/WebService.asmx'
const productList = () => {
fetch(URL + '/ProductList') // It shows the error is here
.then((response) => response.json())
.then((data) => {
settingResults(data);
console.log(' fetch settingResults' + data);
});
};
Error:
Access to fetch at 'http://localhost:63579/WebService.asmx/ProductList' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
net::ERR_FAILED
My Chrome broswer and Visual Studio errors are in Hebrew and I can't change the language English , many people has tried but non received the answer how to do it.
Error (translated):
Application server error '/'.
The application template is not recognized for a URL that ends unexpectedly in '/ ProductList'.
