亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

.net core異常:"Cannot access a disposed object"

.net core異常:"Cannot access a disposed object"

陪伴而非守候 2018-07-31 07:10:30
在一個asp.net core webapi項目的集成測試中遭遇下面的異常,請問如何解決?Cannot access a disposed object. A common cause of this error is disposing a context that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling Dispose() on the context, or wrapping the context in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing context instances. [xUnit.net 00:00:03.2384249]       Object name: 'EfUnitOfWork'. [xUnit.net 00:00:03.2425838]       Stack Trace:依賴注入用的是 services.AddScoped
查看完整描述

1 回答

?
阿波羅的戰車

TA貢獻1862條經驗 獲得超6個贊

翻轉控制器已經釋放了目標對象了,參考修改對象生命周期的方法


查看完整回答
反對 回復 2018-08-25
  • 1 回答
  • 0 關注
  • 3750 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號