Integración con .NET: guía de inicio rápido
El objetivo de esta guía es explicar cómo llevar a cabo una integración básica de CrowdHandler .NET en tu aplicación MVC.
For further customization and advanced configurations, please refer to the project's GitHub repository or NuGet documentation.
1.) Add reference to your project.
La forma más sencilla de hacerlo es mediante NuGet; busca el Crowdhandler.MVCSDK paquete en el gestor de paquetes NuGet o, si lo prefieres, a través de la CLI de dotnet.
dotnet add package Crowdhandler.MVCSDK
2.) Apply the Crowdhandler Filter Attribute to your Controller Actions.
ExampleTicketingController.cs
using Crowdhandler.MVC5SDK;
namespace MyTicketingApp.Controllers
{
public class TicketingController : Controller
{
[CrowdhandlerFilter]
public ActionResult Index()
{
return View();
}
}
}
Configura los patrones de URL que deben ignorarse pasando el parámetro «Exclusions» al filtro con una expresión regular que contenga los patrones que no deseas que se tengan en cuenta para la puesta en cola.
Common patterns to ignore are:
- Paths used for storing static assets and media, e.g. /static-media/*
- URL de devolución de llamada generadas por proveedores de pago externos.
- Formato JSON y fuentes RSS.
ExampleTicketingController.cs
using Crowdhandler.MVCSDK;
namespace MyTicketingApp.Controllers
{
public class TicketingController : Controller
{
[CrowdhandlerFilter(Exclusions = @"^(\/contact-us.*)|((?!.*\?).*(\.(avi|css|eot|gif|ICO|jpg|jpeg|js|json|mov|mp4|mpeg|mpg|og[g|v]|pdf|png|svg|ttf|txt|wmv|woff|woff2|xml)))$")]
public ActionResult Index()
{
return View();
}
}
}
3.) Inject CrowdHandler Configuration.
* Public and Private keys can be found in the Account → API section of the CrowdHandler administration control panel.
a través de app.config o web.config
<appSettings>
<add key="CROWDHANDLER_PUBLIC_KEY" value="YOUR_PUBLIC_KEY"/>
<add key="CROWDHANDLER_PRIVATE_KEY" value="YOUR_PRIVATE_KEY"/>
</appSettings>
Como alternativa, se pueden inyectar directamente en el filtro.
using Crowdhandler.MVC5SDK;
namespace MyTicketingApp.Controllers
{
public class TicketingController : Controller
{
[CrowdhandlerFilter(PrivateApiKey = "YOUR_PRIVATE_KEY", PublicApiKey = "YOUR_PUBLIC_KEY")]
public ActionResult Index()
{
return View();
}
}
}
* A full list of configurables and their default settings can be found in section 2b of the NuGet documentation.
https://www.nuget.org/packages/Crowdhandler.MVCSDK/
4.) Install CrowdHandler JavaScript Integration
¿Por qué tengo que hacer esto si estoy integrando CrowdHandler del lado del servidor?
To ensure that the integration executes as quickly as possible, functionality not considered mission-critical is offloaded to the client side via our JavaScript Integration.
Si esa funcionalidad no es esencial para el funcionamiento del sistema, ¿puedo saltarme este paso?
Theoretically yes, but practically we recommend against it. Installing the JavaScript integration enables features such as page performance tracking and smart session keep alive.
Lo primero es un requisito para que nuestra función de ajuste automático funcione correctamente, además de ofrecer información sobre el rendimiento de tu aplicación bajo carga.
The latter synchronizes session information between the client side and CrowdHandler's backend, preventing recently active users that have spent longer than the configured CrowdHandler session time from being sent to CrowdHandler's session validator for revalidation needlessly.
How do I install the JavaScript integration
The JavaScript can be installed via Google Tag Manager, by directly including it in the head of your master template or in any other way that is convenient to you.
You can find instructions on installing our JavaScript integration.
5.) Change integration type to .NET in CrowdHandler control panel.
La selección de la implementación se puede realizar desde la pantalla de dominios.

6.) What Now?
Once you have completed the .NET integration steps we recommend checking out our getting started guide which will help familiarize you with creating and configuring waiting rooms from within the CrowdHandler control panel.