Answered by:
ASP.NET WebApi (Visual Studio 2013) - CORS Installation Error

Question
-
User135423268 posted
Good Day Everyone
I'm having trouble when installing CORS on my ASP.NET WEBAPI Solution
First I install the CORS using the Package Manager Console by typing this
Install-Package Microsoft.AspNet.WebApi.Cors
After I install this, I try to to test run my site and I receive the error below
Could not load file or assembly 'System.Web.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
after that I found the solution here:
which the solution is
"Update-Package Microsoft.AspNet.WebApi -reinstall."
Now after this I'm not having a problem when running my web application, but my problem right now is
"config.EnableCors()"
EnablCors does not found in HttpConfiguration
The Solution for this is to install again the CORS using this again "Install-Package Microsoft.AspNet.WebApi.Cors"
But I got another error when I try to run my application which is:
A direct route cannot use the parameter 'controller'
and I point on the line below
GlobalConfiguration.Configure(WebApiConfig.Register);
I don't know what to do, What I want is to use the cors for my Web API but an error is always showing.
Please help me to solve this.
Thursday, August 16, 2018 8:57 AM
Answers
-
User1120430333 posted
A direct route cannot use the parameter 'controller'
Maybe, it will lead to a solution.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, August 17, 2018 12:47 PM
All replies
-
Thursday, August 16, 2018 12:50 PM
-
User135423268 posted
I have tried but it says, duplicate post.
Friday, August 17, 2018 7:02 AM -
User1120430333 posted
A direct route cannot use the parameter 'controller'
Maybe, it will lead to a solution.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, August 17, 2018 12:47 PM