InvalidOperationException

Hey Guys, my projects run fine with Windows authentication from with the Radzen IDE, but about a week ago I started getting an InvalidOperationException when running from Visual Studio Community 2019. Even if I create a new Radzen project from scratch, as soon as I enable Windows Authentication, I get the error when starting from VS 2019. Here is the error:

'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.
Microsoft.AspNetCore.Authentication.Negotiate.PostConfigureNegotiateOptions.PostConfigure(string name, NegotiateOptions options)
'
Microsoft.Extensions.Options.OptionsFactory.Create(string name)
Microsoft.Extensions.Options.OptionsMonitor+<>c__DisplayClass11_0.b__0()
System.Lazy.ViaFactory(LazyThreadSafetyMode mode)
System.Lazy.ExecutionAndPublication(LazyHelper executionAndPublication, bool useDefaultConstructor)
System.Lazy.CreateValue()
System.Lazy.get_Value()
Microsoft.Extensions.Options.OptionsCache.GetOrAdd(string name, Func createOptions)
Microsoft.Extensions.Options.OptionsMonitor.Get(string name)
Microsoft.AspNetCore.Authentication.AuthenticationHandler.InitializeAsync(AuthenticationScheme scheme, HttpContext context)
Microsoft.AspNetCore.Authentication.AuthenticationHandlerProvider.GetHandlerAsync(HttpContext context, string authenticationScheme)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
'

I'm running the latest build of VS 2019 - 16.7.7 & .NET Framework - 4.8.04084. I've tried -

  • Clear browser cache
  • Disable all non-Microsoft extensions is VS.
  • Verify all nuget stuff is up to date.
  • Various debugging options in VS for the projects - as per recommendations found via Googling
  • Changed from debug to release in VS Configuration manager

My system is running Windows 10, VS 2019 and Radzen and that's about it - very generic. Windows has all the latest updates installed, Radzen is version 2.54.8. Again, this is occurring with all my Radzen projects that have Windows Auth enabled, but only when starting from VS 2019. When run from Radzen, I don't see any errors produced. Windows authentication was working fine with VS 2019 until about a week ago.

I'm really stumped, please help.

Thank you,
Slosuenos

I searched online and this was the first hit.

@SloSuenos try to run the app directly not with IIS Express:

or set the following to run with IIS Express:

@korchev & @enchev thanks for the support guys. @enchev, I thought I'd tried everything else before, but the setting you displayed on the last screen allows it to run once more. I'd seeming changed the same setting on the properties of the project, but I guess that wasn't exactly the same.

Not sure how my system could have ended up in this state, I'm very conservative. Except, using VS 2019 for a production project is turning out to be a really poor choice. Also having other problems with it, for example the SSRS designer is a buggy mess. Should have stayed with VS 2017.

You guys are the best,
Slosuenos

@enchev its probably no surprise that every time I run the project from the Radzen IDE, the "windowsAuthentication" setting in launchSettings.json returns to false .

I know that I can put this on the ignore list, but I'm concerned - I shouldn't have to, something's not right and will probably cause further issues. I've set security back to none and then Windows again, but this doesn't resolve the issue.

There's a similar setting in the vwd.webinfo file, but changing this doesn't seem to have any effect. Is there somewhere else I can permanently repair this? I guess that if this continues to occur, even with new projects, then I'll have to start reinstalling stuff and hope I find the cause...

Thanks again,
Slosuenos

In the next update of Radzen this setting will be set to true automatically if Windows Authentication is enabled.

1 Like