HTTP 400 Error

Dear Radzen Team,
for the first time, surprisingly deep into my radzen experience, I have encountered a problem I am not able to solve on my own, given that I am the complete SQL and radzen newbie that I am and have almost no knowledge of the topics other than the concept of databases. Over the last weeks I have built a small MS SQL Database and constantly tested its features (e.g. m-n relations, filestream image saving, …) in combination with radzen and never had a problem I could not solve on my own. Today, when I tried to run my radzen application, I could no longer use any of the former functions other than navigate through the different pages. To my knowledge, neither the log.txt nor the radzen output encountered any problems, but the browser development tools showed me this:

HTTP400: BAD REQUEST - The request could not be processed by the server due to invalid syntax.
(XHR)GET - http://localhost:5000/odata/RXMDB/Machines?$top=10&$skip=0&$count=true

(RXMDB is my database, Machine is one of its tables)

since I made a new application for troubleshooting, the mistake should not have been made by me, all I did was setting up an application and connect it to my MS SQL Server. Then I generated pages with the Master Detail Grid and selected some Child data, which has worked before several times. Unfortunatly this time the above error occurred, it went away when I deleted the parameters of the invoke .getMachines, but then came up when I tried to add a Machine. I am clueless, please help :sweat_smile:

Kindest Regards

Paul

Hi Paul,

I see there are such bug reports for Edge browser, do you use it by chance? If yes, can you try your app in different browser to see what will be the result?

Best Regards,
Vladimir

yes I do! I will try to use Mozilla Firefox and see if this works around the problem.

Mozilla does not create this error, however, I am still not able to create new machines, since the application shows the standard error message. I am unable to read the radzen output, so I do not know if the problem is visible there:

dotnet: info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 OPTIONS ht(altered because of 2 link limitation)tp://localhost:5000/odata/RXMDB/Machines
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 OPTIONS ht(altered because of 2 link limitation)tp://localhost:5000/odata/RXMDB/Machines
info: Microsoft.AspNetCore.Cors.Infrastructure.CorsService[4]
Policy execution successful.
info
dotnet: : Microsoft.AspNetCore.Cors.Infrastructure.CorsService[4]
Policy execution successful.
infoinfo: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 0.4497ms 204
: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 0.4497ms 204

dotnet: info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 POST ht(altered because of 2 link limitation)tp://localhost:5000/odata/RXMDB/Machines application/json 59
infoinfo: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 POST ht(altered because of 2 link limitation)tp://localhost:5000/odata/RXMDB/Machines application/json 59
: Microsoft.AspNetCore.Cors.Infrastructure.CorsService[4]
Policy execution successful.
info
dotnet: : Microsoft.AspNetCore.Cors.Infrastructure.CorsService[4]
Policy execution successful.

dotnet: infoinfo: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
Executing action method RxMaintenance.Controllers.Rxmdb.MachinesController.Post (server) with arguments (RxMaintenance.Models.Rxmdb.Machine) - ModelState is Valid
: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
Executing action method RxMaintenance.Controllers.Rxmdb.MachinesController.Post (server) with arguments (RxMaintenance.Models.Rxmdb.Machine) - ModelState is Valid

dotnet: infoinfo: Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor[1]
Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext.
: Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor[1]
Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext.

dotnet: info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
Executed action RxMaintenance.Controllers.Rxmdb.MachinesController.Post (server) in 14.4737ms
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 15.2201ms 400 application/json; odata.metadata=minimal; odata.streaming=true; charset=utf-8
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
Executed action RxMaintenance.Controllers.Rxmdb.MachinesController.Post (server) in 14.4737ms
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 15.2201ms 400 application/json; odata.metadata=minimal; odata.streaming=true; charset=utf-8

Sorry to bother you, but I strongly believe I haven’t altered anything since the last time, when everything still worked.

Hi Paul,

Can you verify in the browser Network tab how the POST request (when you create new records) is executed and what is the response. Here is how it looks normally:

Best Regards,
Vladimir

Solved. Of course, the problem was on my side, the response tab showed me the message “message The InversePropertyAttribute on property ‘ProductGroups’ on type ‘Manufacturer’ is not valid. The property ‘Manufacturer’ is not a valid navigation property on the related type ‘ProductGroup’. Ensure that the property exists and is a valid reference or collection navigation property.” which referred to a relation on the other end of my database, which let both the “Supplier” and “Manufacturer” primary key refer to a shared foreign key “Group_Owner”, which obviously does not work. I split the foreign Key into two and now everthing works fine again. Thank you so much!

Paul