This is an odd one: We have a Web API endpoint that periodically starts throwing this error for every post submitted to any POST controller method of any controller, even though none of the code called by those controllers touches qrySoaHeader_Net
:
"View or function 'dbo.qrySoaHeader_Net' is not updatable because the modification affects multiple base tables."
I completely understand what that message means normally (you're trying to write to a view that doesn't resolve uniquely to a single table), but that's definitely not what's happening in this case.
qrySoaHeader_Net
is a SQL Server view used by an EF entity class (SoaHeader
) to retrieve data for a report. None of the POST methods on any of our controllers are touching SoaHeader
directly and none of the other objects they call are linked to it in EF (because it's a view, so has no relationships in the DB).
If I copy the database back locally I do not get this issue, and if I restart the production IIS the issue goes away and then reappears after a week or so.
Calls to GET methods on controllers continue to work fine, it's just the POSTs that seem to have the issue - the GET methods are all calling code that only retrieves data.
To me that suggests that this must be an issue with something getting 'stuck' on the IIS or the SQL Server? I've checked for open trans with DBCC OPENTRAN
but there aren't any.
Production server is running Microsoft SQL Server 2017 (RTM) - 14.0.1000.169 (X64) Express Edition (64-bit) on Windows Server 2016 Datacenter 10.0 (Build 14393: ) (Hypervisor).
My machine is running Microsoft SQL Server 2017 (RTM-GDR) (KB4293803) - 14.0.2002.14 (X64) Developer Edition (64-bit) on Windows 10 Pro 10.0 (Build 17134: )
Can anyone think of what could cause this error to be thrown regardless of which endpoint is posted to?