You need to have package EPiServer.ServiceLocation.StructureMap installed. Then there is an extension method StructureMap() (in namespace EPiServer.ServiceLocation) that gives you access to the StructureMap container.
You can also use the 'Services' property of ServiceConfigurationContext to configure the IOC container (if you do not use any specific StructureMap feature). See https://world.episerver.com/documentation/developer-guides/CMS/initialization/dependency-injection/
I did and now i'm getting error while browsing the site.
=> This page isn’t working. redirected you too many times.
Following is the exception. Please help to resolve this issue. Thank you !
Server Error in '/' Application.
Method not found: 'StructureMap.IContainer EPiServer.ServiceLocation.ServiceConfigurationContext.get_Container()'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.MissingMethodException: Method not found: 'StructureMap.IContainer EPiServer.ServiceLocation.ServiceConfigurationContext.get_Container()'.
Source Error:
Source File: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\61f0f580\3fbea218\App_global.asax.0.cs Line: 0
Stack Trace: