A local service provider is not configured.

I’m getting a “A local service provider is not configured” exception but I’m not the provider I’m the initiator.
the error happens when I call SAMLServiceProvider.ReceiveSSO.
Here is the stack trace:
ComponentSpace.SAML2.Exceptions.SAMLConfigurationException:
at ComponentSpace.SAML2.Configuration.Resolver.SAMLConfigurationResolver.GetLocalServiceProviderConfiguration (ComponentSpace.SAML2, Version=4.2.0.0, Culture=neutral, PublicKeyToken=16647a1283418145)
at ComponentSpace.SAML2.InternalSAMLServiceProvider…ctor (ComponentSpace.SAML2, Version=4.2.0.0, Culture=neutral, PublicKeyToken=16647a1283418145)

When acting as the service provider, your SAML configuration must include a local service provider configuration and a partner identity provider configuration.

If you’re using a saml.config, this means you must include a and a .

For an example configuration, I suggest taking a look at the ExampleServiceProvider project’s saml.config.

For more information, please refer to the Configuration Guide.


[quote]
ComponentSpace - 7/19/2023
When acting as the service provider, your SAML configuration must include a local service provider configuration and a partner identity provider configuration.

If you're using a saml.config, this means you must include a and a .

For an example configuration, I suggest taking a look at the ExampleServiceProvider project's saml.config.

For more information, please refer to the Configuration Guide.


[/quote]

I'm not using the saml.config I pass the configuration to the SAMLController and using the SAMLServiceProvider.ReceiveSSO to receive the SAML Response from the Identity Provider, this problem is not consistent it happens sometimes.
Note: if I delete the cookies, it starts working again.
Here is the code:

Is UseAzureSSO being called once at application start-up or is it being called as part of an SSO flow?

Our recommendation is to set the SAMLController.Configuration property etc once at application start-up. If you set it as part of SSO you may run into intermittent issues with one thread accessing the configuration while another is setting it.

If your configuration is dynamic and you wish to ensure you have the latest version, you should implement the ISAMLConfigurationResolver interface rather than setting the SAMLController.Configuration. For more information, refer to the Configuration Guide.

[quote]
ComponentSpace - 7/20/2023
Is UseAzureSSO being called once at application start-up or is it being called as part of an SSO flow?

Our recommendation is to set the SAMLController.Configuration property etc once at application start-up. If you set it as part of SSO you may run into intermittent issues with one thread accessing the configuration while another is setting it.

If your configuration is dynamic and you wish to ensure you have the latest version, you should implement the ISAMLConfigurationResolver interface rather than setting the SAMLController.Configuration. For more information, refer to the Configuration Guide.
[/quote]

Implementing the ISAMLConfigurationResolver and adding the ConfigurationID to the SAMLController.ConfigurationID Worked, Thanks.

Thanks for the update.