Forum Discussion
How to fix 'Operation is not valid due to the current state of the object ' in .NET Azure Function?
I have a .NET Azure Function executed by Logic Apps triggered by an SQL connector "When an item is created V2". The function gathers data from multiple APIs and inserts the data into a SQL DB. The function works good for singular records, however, when a batch of records is inserted into the SQL table triggering the function, then the function breaks with the following error:
Operation is not valid due to the current state of the object
According to multiple threads on the Stack Overflow (i.e. https://stackoverflow.com/questions/8832470/operation-is-not-valid-due-to-the-current-state-of-the-object-error-during-pos ), to resolve the problem the web config file should be configured in the following way:
<appSettings>
<add key="aspnet:MaxHttpCollectionKeys" value="2001" />
</appSettings>
Is there any way to change the web.config file of an Azure Function App? Where I will find it? Or should I create it by myself? Do you have any other ideas on how to resolve the issue?