Skip to main content

Posts

Showing posts from March, 2017

Connot disposed object. Object Name 'System.serviceModelSecurity.TransportSecurityProtocol'

 I and working n ASP.NET WebApi application with some code that calls that Get method to get a OrganizationServiceProxy object, and then proceeds to call various methods on that OrganizationServiceProxy object. For example, part of the login process does this. The way your Get method works is, each time it is called, it will first close the OrganizationServiceProxy object that it returned previously (regardless of whether or not it is still being used) then create and return a new one. Imagine two users attempt to log in to your application at almost the same time - within milliseconds of each other. The thread handling the first user's login calls Get and gets its OrganizationServiceProxy object, then a millisecond later the thread handling the second user's login calls Get, which causes the first thread's OrganizationServiceProxy object to be closed. However, the first thread is still running, and now when it attempts to call a method on it's OrganizationServ...