Why can’t I get my ASP.NET web app to work with IT FoxTec SAML?

  Kiến thức lập trình

I have an older service provider web app running a mix of ASP.NET 4.8 and .NET Core 2.0.

I am trying to integrate the ITFoxTec SAML package into it.

I have everything working except a method in my MetadataController class.

I have this in my MetadataController.cs:

I am getting this error:

  The type or namespace name 'ServiceName' could not be found (are you missing a using directive or an assembly reference?)

Here is everything I am importing:

using ITfoxtec.Identity.Saml2.Schemas.Metadata;
using ITfoxtec.Identity.Saml2.Schemas;
using ITfoxtec.Identity.Saml2;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Security.Cryptography.X509Certificates;
using ITfoxtec.Identity.Saml2.MvcCore;
using Microsoft.Extensions.Options;
using System;
using System.Linq;
using System.Collections.Generic;

And here is the problem area:

  public IActionResult Index()
        var defaultSite = new Uri($"{Request.Scheme}://{Request.Host.ToUriComponent()}/");

        var entityDescriptor = new EntityDescriptor(config);
        entityDescriptor.ValidUntil = 365;
        entityDescriptor.SPSsoDescriptor = new SPSsoDescriptor
            WantAssertionsSigned = false,
            AssertionConsumerServices = new AssertionConsumerService[]
                new AssertionConsumerService { Binding = ProtocolBindings.HttpPost, Location = new Uri(defaultSite, "Auth/AssertionConsumerService") },
            AttributeConsumingServices = new AttributeConsumingService[]
            {   // It doesn't recognize 'ServiceName'
                new AttributeConsumingService { ServiceName = new ServiceName("LegacyEnrollmentArea", "en"), RequestedAttributes = CreateRequestedAttributes() }

Is there anyway to fix it?