cordova , , -api. -api, . , CORS -.
CORS, Microsoft.AspNet.WebApi.Cors NuGet EnableCors. :
using System.Collections.Generic;
using System.Web.Http;
using System.Web.Http.Cors;
using WebApiServer.Models;
namespace WebApiServer.Controllers
{
[RoutePrefix("databases")]
[EnableCors("*", "*", "*")]
public class DatabasesController : ApiController
{
[Route("")]
[HttpGet]
public IHttpActionResult Get()
{
var databases = new List<DatabaseCategory>()
{
new DatabaseCategory
{
CategoryName = "Bases de datos relacionales",
Databases = new List<Database>()
{
new Database() { DatabaseName = "SQL Server" },
new Database() { DatabaseName = "Oracle" },
new Database { DatabaseName = "PostgreSQL" }
}
},
new DatabaseCategory
{
CategoryName = "Bases de datos NoSQL",
Databases = new List<Database>()
{
new Database() { DatabaseName = "RavenDB" },
new Database { DatabaseName = "CouchBase" },
new Database { DatabaseName = "MongoDB" }
}
}
};
return Ok(databases);
}
}
}
, ( ), http://localhost:26309/databases, 26309 itseft, , -. , ERR_CONNECTION_REFUSED, .
http://localhost:26309 IP- DNS-, . http://192.168.8.162:26309 http://yourMachine.yourDomain.com:26309. , -api - IIS Express, . , Visual Studio . IIS . Windows 10 Pro, URL rewrite ARR :
- IIS, , Windows
., .
- URL Rewrite 2.0
- 3.0
- -. . 26308 ( : IIS Express - 1). .
- -. "URL Rewrite"
- "" " ", " "
- localhost: 26309 " IP-..."
- ""
- TCP- 26308 Windows.
cordova, - IIS. http://192.168.8.162:26308 http://yourMachine.yourDomain.com:26308
cordova api -, , .
, , USB. Wi-Fi, .