System.ObjectDisposedException: 'Cannot access a disposed object. Object name: 'IServiceProvider'.'Dispose, when is it called?System.ObjectDisposedException: Cannot access a disposed object - Why happening?Is it OK to use a DataReader after disposing the Command object?Firebase + auth0 authenticationAuth0 with Firebase DelegationCustom authentication integration with parse-server and auth0auth0 authentication for react-native-ios that communicates with php serverWhat's the correct way to cancel an operation with a callback on a disposable object?System.ObjectDisposedException: 'Cannot access a disposed object.'.Net Core 2.1 - Cannot access a disposed object.Object name: 'IServiceProvider'

Can the U.S. president make military decisions without consulting anyone?

US entry with tourist visa but past alcohol arrest

Can multiple wall timers turn lights on or off when required?

How does IBM's 53-bit quantum computer compares to classical ones for cryptanalytic tasks?

Norwegian refuses EU delay (4.7 hours) compensation because it turned out there was nothing wrong with the aircraft

How to create a grid following points in QGIS?

Did Apollo carry and use WD40?

Social leper versus social leopard

Temporarily moving a SQL Server 2016 database to SQL Server 2017 and then moving back. Is it possible?

Manager encourages me to take day of sick leave instead of PTO, what's in it for him?

Pandas aggregate with dynamic column names

Is it true that, "just ten trading days represent 63 per cent of the returns of the past 50 years"?

Why does NASA publish all the results/data it gets?

The 100 soldier problem

How to manage expenditure when billing cycles and paycheck cycles are not aligned?

Where Does VDD+0.3V Input Limit Come From on IC chips?

Can planetary bodies have a second axis of rotation?

What do these pins mean? Where should I plug them in?

Is It Possible to Have Different Sea Levels, Eventually Causing New Landforms to Appear?

Do the villains know Batman has no superpowers?

Is there any actual security benefit to restricting foreign IPs?

Figuring out the frequency components using FFT

Is this a Sherman, and if so what model?

How to influence manager to not schedule team meetings during lunch?



System.ObjectDisposedException: 'Cannot access a disposed object. Object name: 'IServiceProvider'.'


Dispose, when is it called?System.ObjectDisposedException: Cannot access a disposed object - Why happening?Is it OK to use a DataReader after disposing the Command object?Firebase + auth0 authenticationAuth0 with Firebase DelegationCustom authentication integration with parse-server and auth0auth0 authentication for react-native-ios that communicates with php serverWhat's the correct way to cancel an operation with a callback on a disposable object?System.ObjectDisposedException: 'Cannot access a disposed object.'.Net Core 2.1 - Cannot access a disposed object.Object name: 'IServiceProvider'






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am setting up a registerservice in a .net core backend where an admin can add a new user to the database and the user will get a verication-email.



I use Mediatr to add data to my database and I use auth0 as a login platform.



This is my method, triggered by an http request.



[HttpPut]
public async void Put([FromBody] User user)

var token = await _authController.Get();
var id = "";
id = await _authController.Post(user.Mail, token);
_authController.Postpass(user.Mail, id, token);
id = id.Remove(0, 6);
await _mediator.Send(new PutUser

UserId = id,
User = user
);






Whenever I execute the api call with the needed data it throws an error whilst trying to execute this code:



await _mediator.Send(new PutUser 
...
)};


This is the error:



System.ObjectDisposedException: 'Cannot access a disposed object. Object name: 'IServiceProvider'.'


I expect that the call get's executed and the user gets added to the database.



All the code above works and has been tested, it doesn't work if I Use a different Mediatr class and all my other calls work.
It has something to do with the code above the Mediatr call, because when I delete the code and only do the Mediatr call it does work.



Can anyone help me?










share|improve this question






























    0















    I am setting up a registerservice in a .net core backend where an admin can add a new user to the database and the user will get a verication-email.



    I use Mediatr to add data to my database and I use auth0 as a login platform.



    This is my method, triggered by an http request.



    [HttpPut]
    public async void Put([FromBody] User user)

    var token = await _authController.Get();
    var id = "";
    id = await _authController.Post(user.Mail, token);
    _authController.Postpass(user.Mail, id, token);
    id = id.Remove(0, 6);
    await _mediator.Send(new PutUser

    UserId = id,
    User = user
    );






    Whenever I execute the api call with the needed data it throws an error whilst trying to execute this code:



    await _mediator.Send(new PutUser 
    ...
    )};


    This is the error:



    System.ObjectDisposedException: 'Cannot access a disposed object. Object name: 'IServiceProvider'.'


    I expect that the call get's executed and the user gets added to the database.



    All the code above works and has been tested, it doesn't work if I Use a different Mediatr class and all my other calls work.
    It has something to do with the code above the Mediatr call, because when I delete the code and only do the Mediatr call it does work.



    Can anyone help me?










    share|improve this question


























      0












      0








      0








      I am setting up a registerservice in a .net core backend where an admin can add a new user to the database and the user will get a verication-email.



      I use Mediatr to add data to my database and I use auth0 as a login platform.



      This is my method, triggered by an http request.



      [HttpPut]
      public async void Put([FromBody] User user)

      var token = await _authController.Get();
      var id = "";
      id = await _authController.Post(user.Mail, token);
      _authController.Postpass(user.Mail, id, token);
      id = id.Remove(0, 6);
      await _mediator.Send(new PutUser

      UserId = id,
      User = user
      );






      Whenever I execute the api call with the needed data it throws an error whilst trying to execute this code:



      await _mediator.Send(new PutUser 
      ...
      )};


      This is the error:



      System.ObjectDisposedException: 'Cannot access a disposed object. Object name: 'IServiceProvider'.'


      I expect that the call get's executed and the user gets added to the database.



      All the code above works and has been tested, it doesn't work if I Use a different Mediatr class and all my other calls work.
      It has something to do with the code above the Mediatr call, because when I delete the code and only do the Mediatr call it does work.



      Can anyone help me?










      share|improve this question














      I am setting up a registerservice in a .net core backend where an admin can add a new user to the database and the user will get a verication-email.



      I use Mediatr to add data to my database and I use auth0 as a login platform.



      This is my method, triggered by an http request.



      [HttpPut]
      public async void Put([FromBody] User user)

      var token = await _authController.Get();
      var id = "";
      id = await _authController.Post(user.Mail, token);
      _authController.Postpass(user.Mail, id, token);
      id = id.Remove(0, 6);
      await _mediator.Send(new PutUser

      UserId = id,
      User = user
      );






      Whenever I execute the api call with the needed data it throws an error whilst trying to execute this code:



      await _mediator.Send(new PutUser 
      ...
      )};


      This is the error:



      System.ObjectDisposedException: 'Cannot access a disposed object. Object name: 'IServiceProvider'.'


      I expect that the call get's executed and the user gets added to the database.



      All the code above works and has been tested, it doesn't work if I Use a different Mediatr class and all my other calls work.
      It has something to do with the code above the Mediatr call, because when I delete the code and only do the Mediatr call it does work.



      Can anyone help me?







      .net .net-core auth0 mediatr






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 28 at 15:02









      Vital VerleyenVital Verleyen

      168 bronze badges




      168 bronze badges

























          0






          active

          oldest

          votes










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );














          draft saved

          draft discarded
















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55400831%2fsystem-objectdisposedexception-cannot-access-a-disposed-object-object-name%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes




          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.




















          draft saved

          draft discarded















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55400831%2fsystem-objectdisposedexception-cannot-access-a-disposed-object-object-name%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript