Could not load type 'Microsoft...SqlAppAuthenticationProvider' from assembly 'Microsoft...AppAuthentication'

456 views Asked by At

I am following the guide at learn.microsoft.com for securing Azure SQL database connections from App Services. I have an ASP.NET MVC 5 web application that references an Entity Framework 6 class library, and both projects are targetting .NET 4.7.2.

I have installed the Microsoft.Azure.Services.AppAuthentication package via NuGet (to both projects), and added the requisite Authentication Provider Config Sections and SqlAuthenticationProvider references in the web.config.

Upon starting the app, I login and as soon as a database call is made, it results in an exception:

Could not load type 'Microsoft.Azure.Services.AppAuthentication.SqlAppAuthenticationProvider' from assembly 'Microsoft.Azure.Services.AppAuthentication'.

I have also tried targetting versions 4.7.1 and 4.8. I have added conditional compilation symbols for all three versions of .NET. None of the fixes that I have seen that work for others appear to be working for me. In any case, the SqlAppAuthenticationProvider does not appear in the object browser.

Object browser view of the Microsoft.Azure.Services.AppAuthentication namespace

1

There are 1 answers

2
CodeWarrior On BEST ANSWER

OK, turns out the tutorial linked above actually specifies the version of the NuGet package, and it has been updated since then. I had not paid attention to that fact when I installed the Microsoft.Azure.Services.AppAuthentication package.

New version fixed the issue.