带有MongoDB 500错误的ASP.NET Core Web API [英] Asp.net core web api with mongodb 500 error

查看:71
本文介绍了带有MongoDB 500错误的ASP.NET Core Web API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在关注本教程

我在Visual Studio中没有其他错误.我对此很陌生,所以我的问题是,如何诊断这种类型的错误?如果有必要,我很乐意提供代码,在此先感谢您提供的任何帮助.

Git存储库

解决方案

我知道了我的问题.在我的代码中,我有一个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.

这篇关于带有MongoDB 500错误的ASP.NET Core Web API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆