且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

带有MongoDB 500错误的ASP.NET Core Web API

更新时间:2023-02-15 22:07:21

我知道了我的问题.在我的代码中,我有一个postID,但我没有意识到MongoDB自动创建了一个引用为ID的ObjectID.因此,当涉及到调用该对象ID时,我当然使用了我的postID调用.这导致mongo DB失败,而且我还没有意识到错误是在控制台窗口的顶部抛出的.从那以后,我在git中更新了我的项目,进行了必要的更改.

I have been following this tutorial here. With some help I have finally completed it and attempted to deploy locally on my machine. I get the following error...

I get no other errors in Visual studios. I am rather new to this so my question is this, How do I diagnose this type of error? I am happy to provide code if necissary, thanks in advance for any help given.

Git repo

Github

Edit

Photo of IIS express warning...

I have figured out my issue. In my code I have a postID, What I didn't realize was that MongoDB auto creates an ObjectID referenced as ID. So when it came to calling that object ID I of course used my postID call. This caused the mongo DB to fail, Also I didnt realize the error was being thrown way up at the top of my console window. I have since updated my project in git with the necessary changes.