Skip to main content

Install the .NET Framework agent manually with NuGet

In some instances, you may prefer to manually install the .NET Framework agent using NuGet. For example, this can be useful if you are unable to access the Azure App Service site extension or if you prefer to include the .NET Framework agent as a dependency.

  1. Add the Contrast NuGet package to your application.

    In Visual Studio, under the application project in the Solution Explorer, right-click on References and select Manage NuGet Packages.

    Search for the Contrast.Net.Azure.AppService package, select it and add it to your project.

    Build your application. Confirm that Contrast assemblies (for example, ContrastProfiler.dll) are in a new  contrastsecurity folder that's created in the application's root directory.

  2. Add application authentication settings for Contrast.

    You can either add the authentication settings through the App Service Settings window in Visual Studio's "Publish to Azure App Service", or directly through the Azure App Service Portal.

    Set the Contrast authentication keys that the agent needs to connect to Contrast, and select Save. You can find your keys in your profile.

  3. Follow the build process from the dotnet source code repository.

  4. Go to the Application settings area of your application in the Azure Portal. Set the Contrast authentication keys that the agent needs to connect to Contrast, and select Save.

  5. Using Visual Studio, publish the application to Azure.

    Once the application has loaded, use the application and then open Contrast to verify that the server and application are active, and that any expected vulnerabilities appear.