Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Following are some common errors that might occur with the Tsplice web API:

...

Expand

...

title

...

ASP.NET Core app fails to start due to CryptographicException

Symptoms

When trying to request some data from the Tsplice API, an error message is returned to the client:

HTTP Error 500.30 - ASP.NET Core app failed to start

and the Windows Application event log shows a message like the following:

Code Block
Application: w3wp.exe
CoreCLR Version: 8.0.123.58001
.NET Version: 8.0.1
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Security.Cryptography.CryptographicException: The system cannot find the file specified.
   at System.Security.Cryptography.CapiHelper.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
   at System.Security.Cryptography.RSACryptoServiceProvider.get_SafeProvHandle()
   at System.Security.Cryptography.RSACryptoServiceProvider.get_SafeKeyHandle()
   at System.Security.Cryptography.RSACryptoServiceProvider..ctor(Int32 keySize, CspParameters parameters, Boolean useDefaultKeySize)
   at TPRI.Tsecurity.SigningKey.Load() in d:\tpriNtRt\std\Projects\TPRI.Tsecurity\SigningKey.cs:line 30
   at TspliceWebApi.Program.Main(String[] args) in d:\tpriNtRt\std\Projects\TspliceApi\Program.cs:line 27

Explanation

This error occurs because the web server’s application pool’s Load User Profile setting is set to False.

Resolution

Follow the instructions at Installation Requirements to fix the Load User Profile setting. See also https://stackoverflow.com/q/17840825.

Expand
titleASP.NET Core app fails to start due to

...

CryptographicException

Symptoms

When trying to request some data from the Tsplice API, an error message is returned to the client:

HTTP Error 500.30 - ASP.NET Core app failed to start

and the Windows Application event log shows a message like the following:

Code Block
Category: Microsoft.AspNetCore.Hosting.Diagnostics
EventId: 6

Application startup exception

Exception: 
System.InvalidOperationException: The Negotiate Authentication handler cannot be used on a server that directly supports Windows Authentication. Enable Windows Authentication for the server and the Negotiate Authentication handler will defer to it.
   at Microsoft.AspNetCore.Authentication.Negotiate.PostConfigureNegotiateOptions.PostConfigure(String name, NegotiateOptions options)
   at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at Microsoft.Extensions.Options.OptionsCache`1.GetOrAdd[TArg](String name, Func`3 createOptions, TArg factoryArgument)
   at Microsoft.Extensions.Options.OptionsMonitor`1.Get(String name)
   at Microsoft.AspNetCore.Authentication.Negotiate.Internal.NegotiateOptionsValidationStartupFilter.<>c__DisplayClass2_0.<Configure>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)

Explanation

This error occurs because Windows Authentication is disabled in the web server application’s Authentication settings.

Resolution

Follow the instructions at Installation Requirements to fix the Windows Authentication setting.