Specifically, I have been working my way thru the book ASP.Net Web API 2: Building a REST Service from Start to Finish. I am on the last chapter, and everything had been going ok, but now I am stuck: the sample web site requires Cross-Origin Resource Sharing
installed and configured. This consists of doing some NuGet Install-package, which went ok, and adding config.EnableCors() and adding an attribute [EnableCors...] to the appropriate parts of the code. When I compile and run, at the point where the web site
sends the request, I get this error:
"XMLHttpRequest cannot load http://localhost:49952/api/V1/tasks. Credentials flag is 'true', but the 'Access-Control-Allow-Credentials' header is ''.It must be 'true' to allow credentials."
But the response headers include
"Access-Control-Allow-Headers:content-type", and "Access-Control-Allow-Origin:http://localhost:52976", and the URL is correct (it is the URL to the client web application)
I've looked up CORS on the ASP.Net, MSDN and StackOverflow sites, and they all give the same steps as in the book.
I have another problem with ASP.Net Web API 2: Visual Studio frequently gets stuck while compiling: i.e. I do a clean and then rebuild, and it gets about 95% thru, and then does nothing. I can't cancel the build, and can't close Visual Studio, so I have
to kill it with Task manager. After reloading and rebuilding, it is fine again for a while. I have never had this problem with any other type of application. I mostly to Web applications, web services, and some desktop applications. Is ASP.Net Web API 2 ready
for production applications?
Davesemm