I have an ASP.NET web application that I created from Visual Studio 2015 Community Edition. The .NET Framework is 4.6.1.
I have no idea which version of ASP.NET my web application is using ASP.NET MVC 4? ASP.NET MVC 5? It's not mentioned anywhere.
I'm trying to register IMemoryCache
service (from Microsoft.Extensions.Caching.Memory
) into my Microsoft Unity container. However, anything I found about it on Google refers to adding services.AddCaching()
in a Startup.cs
file.
I don't have a Startup.cs
file. I only see Global.asax
. Furthermor, all my custom dependencies are registered within UnityConfig.cs
which was provided when installing the NuGet package Unity.Mvc
which is a Microsoft Unity bootstrapper for ASP.NET by Microsoft.
Any help appreciated.
Edit:
Here's a screenshot of my project:
The things you are referring to are part of the ASP.Net Core (ASP.Net 5)
In the new version you no longer have a Global.asax file, you have a new Startup processed defined in a Startup class. Also, DI is standard, so things work in a different way now. So either upgrade to the latest version of ASP.Net or apply use the DI solutions for the older version:
RESOLVING DEPENDENCIES IN ASP.NET MVC 5 USING UNITY CONTAINER
Also the package you are using is for the new ASP.NET version.