简体   繁体   中英

Azure functions and ASP.NET membership

I have an Azure function that cleans a database of inactive users. This cleanup involves deletion of ASPNET Membership entries, by using:

System.Web.Security.Membership.DeleteUser(username);

The problem is that the ASPNET Membership framework expects the connection string in a app.config/connection.config file (see https://msdn.microsoft.com/en-us/library/6e9y4s5t.aspx ).

I have added an app.config file with the necessary information to my Azure function but this did not work. I get the next error:

System.Configuration.Provider.ProviderException: 'The connection name >'LocalSqlServer' was not found in the applications configuration or the >connection string is empty.'

Do you have any ideas how to achieve this?

So according to Microsoft's documentation on Azure Functions "A function app hosts the execution of your functions in Azure. It is a best practice to store connection strings and other secrets in your function app settings."

You can look at the sample below that implements something very similar to what you are doing.

The connection string is added in the Azure Portal by going to Azure Function App and selecting Platform Features then Application settings and adding the entry to the Connection Strings section.

Azure Function App example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM