0

I'm using ServiceStack's funq, I'm trying to get a hold on the place where the IOC gets disposed at the end of a request. Particularly for the entries with scope = ReuseScope.Request.

I'm looking at RestHandler's ProcessRequest method, which is the method that gets called directly by Asp.NET, and it ends like this:

(...)    
        if (doJsonp && !(response is CompressedResult))
                httpRes.WriteToResponse(httpReq, response, (callback + "(").ToUtf8Bytes(), ")".ToUtf8Bytes());
            else
                httpRes.WriteToResponse(httpReq, response);
        }
        catch (Exception ex)
        {
            if (!EndpointHost.Config.WriteErrorsToResponse) throw;
            HandleException(httpReq, httpRes, operationName, ex);
        }
    }

I see no reference to a Funq disposal. What am I missing here? Thanks

Cristóvão
  • 255
  • 1
  • 2
  • 11

1 Answers1

0

Container Scope is the same as Singleton Scope and only gets disposed when the AppHost is disposed.

RequestScoped resources are disposed in ServiceStackHost.OnEndRequest()

You can override AppHost.Release(object instance) in your AppHost to get notified when ServiceStack releases resources.

Benjamin Hodgson
  • 42,952
  • 15
  • 108
  • 157
mythz
  • 141,670
  • 29
  • 246
  • 390
  • Sorry my mistake. It was ReuseScope.Request I am looking for the call. Where is this triggered? Thanks – Cristóvão Feb 19 '14 at 18:35
  • Updated answer, in ServiceStackHost.OnEndRequest() – mythz Feb 19 '14 at 18:38
  • @Blitzkrieg No that shouldn't be possible, the call usually originates from the **EndRequest()** extension method which is called from every known exit point. – mythz Feb 19 '14 at 19:15