I have a Razor Pages app that I am design and then publishing.
When I run it on Server 2016 in IIS, I can add items to the database and update items in the database, but when I try to remove an item from the database, it gives me a 500 error. I thought it was an issue with the specific code where I try to remove a record from the DB, but it does the same thing in other places.
On my computer, it works as it should.
Here is one of the examples:
public async Task<IActionResult> OnPostDeleteOrderLine(string subPO)
{
string PON = "";
if(subPO != null)
{
SteelOrderLine orderLine =
_MCSContext
.SteelOrderLines
.First(sol => sol.SubPO.Equals(subPO));
PON = _MCSContext
.SteelOrders
.First(so => so.ID == orderLine.SteelOrdersID)
.PONumber;
_MCSContext.SteelOrderLines.Remove(orderLine);
await _MCSContext.SaveChangesAsync();
}
return RedirectToPage("CRUD", "EditLine", new { PONumber = PON });
}
Are there any settings in sql or in my Razor Pages project that might affect only Remove in the published project?