User1520731567 posted
Hi sidd-mehta,
I can provide some help on some issues.
- Improvements, or check for bottleneck in terms of performance, security etc.
From Data: optimize the sql algorithm and avoid loading large amounts of data at once.
From code: optimize the query statement, lazy loading,you can use the cache appropriately.
And you could use
F12 developer tool Performance to check your website.
- Enabling CORS in Web API.
If you are wondering how to enable CORS in your Web API, you should install the
Microsoft.AspNet.WebApi.Cors package, which is available on NuGet.
In Visual Studio, select Library Package Manager from the Tools menu, and then select Package Manager Console. Write the following command in the console window:
Install-Package Microsoft.AspNet.WebApi.Cors -pre -project WebService
In the Solution Explorer, expand the WebApi project. Open the file
App_Start/WebApiConfig.cs, and add the following code to the method WebApiConfig.Register.
using System.Web.Http;
namespace WebService
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// New code
config.EnableCors();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
}
Then add the attribute [EnableCors] to the desired controller.
More details,you could refer to this article:
https://www.hexacta.com/2014/09/15/How-to-enable-CORS-on-your-Web-API
Hope these can be helpful to you.
Best Regards.
Yuki Tao