This is the error occurs in the Client application
that is consuming the WEB API. There might be two different reasons,
Web API by
default doesn’t allow Service to be consumed from different domains.
1. RESOLVED BY CORS:
[WEB API APPLICATION]
Open Tools -> NuGet Package
Manager - > Package Manager Console
And install NuGet
packages
Install-Package
Microsoft.AspNet.WebApi.Cors
GO to WebApiConfig.cs
Add [
using
System.Web.Http.Cors; ]
namespace in webapiConfig.cs file
EnableCorsAttribute cors = new
EnableCorsAttribute("*", "*", "*");
CONFIG.EnableCors(cors);
First star resembles allow requests from all domains,
else we can specify specific client URLS, separated by comma (,).
Second
star resembles allow requests for all the headers.
Third
star resembles allow requests for all the methods like POST, GET, PUT, DELETE,
etc
2. RESOLVED BY REMOVING HEADERS IN
CLIENT REQUEST[AFTER CORS IMPLEMENTATION]
4 Comments
thanks buddy, its worked for me, thanks a lot :)
ReplyDeleteNice post. I study one thing tougher on completely different blogs everyday.This is a very nice blog that I will definitively come back to more times this year!
ReplyDeleteplay Battle for the Galaxy Break The Cup For boy play Rapunzel Fashionista Busy Day game
Nice blog!! I really got to know many new tips by reading your blog. Thank you so much for detailed information! It is very helpful to me. Kindly continue the work.
ReplyDeleteEducation Franchise India
Spoken English Franchise
Franchise For Spoken English Classes
Top Education Franchise In India
Best Education Franchise In India
Computer Education Franchise
Education Franchise India
Computer Center Franchise
Education Franchise Opportunities In India
So first you soak your Red Wheat Berries, for 8-24 hours. You can buy Red Wheat Berries at your local health food store, often in the bulk section. And yes wheatgrass is gluten free. I too, was concerned, but after searching around and asking a licensed dietitian friend in the area, the grass itself does not contain any gluten, only the kernel, and in juicing wheatgrass you only juice the grass, so yay!
ReplyDeletekizi 2 unblocked
friv jogos 2019
play friv Games