Aspnetcore: RC2 -'IServiceCollection' does not contain a definition for 'AddCaching'

Created on 24 Jun 2016  路  4Comments  路  Source: dotnet/aspnetcore

package.json
"Microsoft.AspNetCore.Session":"1.0.0-rc2-*", "Microsoft.Extensions.Caching.Memory":"1.0.0-rc2-*"

Startup.cs
public void ConfigureServices(IServiceCollection services) { services.AddSession(); services.AddCaching(); }

public void Configure(IApplicationProvider app) { app.AddSession(); }

I am unable to resolve dependency for method AddCaching() and getting error: 'IServiceCollection' does not contain a definition for 'AddCaching' and no extension method 'AddCaching' accepting a first argument of type 'IServiceCollection' could be found.

Even I comment this method call and compile code, receive another error: Unable to resolve service for type 'Microsoft.AspNetCore.Session.ISessionStore' while attempting to activate 'Microsoft.AspNetCore.Session.SessionMiddleware'

Basically, RC2 documentation is not in place (#1508).

Most helpful comment

@avikenjale the method got renamed to AddMemoryCache.

@javiercn could you create an announcement for https://github.com/aspnet/Caching/commit/a6c044c1590b16c98df1cc6d01eca1140a86ee99 if there isn't one already?

All 4 comments

@avikenjale the method got renamed to AddMemoryCache.

@javiercn could you create an announcement for https://github.com/aspnet/Caching/commit/a6c044c1590b16c98df1cc6d01eca1140a86ee99 if there isn't one already?

@pranavkm, That is fine, however I am still getting the error of service. Any idea how it can be resolved? Am I still missing anything?

I believe you also need to do AddDistributedMemoryCache()

This issue is being closed because it has not been updated in 3 months.

We apologize if this causes any inconvenience. We ask that if you are still encountering this issue, please log a new issue with updated information and we will investigate.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

guardrex picture guardrex  路  3Comments

farhadibehnam picture farhadibehnam  路  3Comments

BrennanConroy picture BrennanConroy  路  3Comments

ermithun picture ermithun  路  3Comments

FourLeafClover picture FourLeafClover  路  3Comments