8. Ran the project.9. hit localhost://xxx/episerver
Server Error in '/' Application.
No owin.Environment item was found in the context.
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.InvalidOperationException: No owin.Environment item was found in the context.
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
[InvalidOperationException: No owin.Environment item was found in the context.]
System.Web.HttpContextExtensions.GetOwinContext(HttpContext context) +78
EPiServer.Cms.UI.AspNetIdentity.<>c.<ConfigureContainer>b__0_3(IServiceLocator s) +31
EPiServer.ServiceLocation.Internal.TypedFactory`1.<Create>b__2_0(IServiceLocator s) +13
lambda_method(Closure , IBuildSession , IContext ) +181
[StructureMapBuildException: Failure while building 'Lambda: Invoke(value(EPiServer.ServiceLocation.Internal.StructureMapConfiguredType`1+<>c__DisplayClass11_0`1[EPiServer.Shell.Security.UISignInManager,EPiServer.Shell.Security.UISignInManager]).instanceAccessor, value(EPiServer.ServiceLocation.Internal.StructureMapConfiguredType`1[EPiServer.Shell.Security.UISignInManager])._serviceLocator)', check the inner exception for details
1.) Lambda: Invoke(value(EPiServer.ServiceLocation.Internal.StructureMapConfiguredType`1+<>c__DisplayClass11_0`1[EPiServer.Shell.Security.UISignInManager,EPiServer.Shell.Security.UISignInManager]).instanceAccessor, value(EPiServer.ServiceLocation.Internal.StructureMapConfiguredType`1[EPiServer.Shell.Security.UISignInManager])._serviceLocator)
2.) Instance of EPiServer.Shell.Security.UISignInManager
lambda_method(Closure , IBuildSession , IContext ) +491
StructureMap.Building.BuildPlan.Build(IBuildSession session, IContext context) +92
StructureMap.BuildSession.BuildNewInSession(Type pluginType, Instance instance) +92
StructureMap.Pipeline.NulloTransientCache.Get(Type pluginType, Instance instance, IBuildSession session) +14
StructureMap.BuildSession.ResolveFromLifecycle(Type pluginType, Instance instance) +47
StructureMap.SessionCache.GetObject(Type pluginType, Instance instance, ILifecycle lifecycle) +128
StructureMap.SessionCache.GetDefault(Type pluginType, IPipelineGraph pipelineGraph) +100
StructureMap.Container.GetInstance(Type pluginType) +178
EPiServer.ServiceLocation.StructureMapServiceLocator.DoGetInstance(Type serviceType, String key) +40
EPiServer.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) +42
[ActivationException: Activation error occurred while trying to get instance of type UISignInManager, key ""]
EPiServer.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) +101
EPiServer.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +26
FYI, I did a clean, and restarted VS. did not help
FYI, I tried setting optimizeCompilations="false" in Web.config, which is apparently the workaround, but now I get the below when trying to launcha page or trying to login with /episerver.
Server Error in '/' Application.
The following errors occurred while attempting to load the app.
- No assembly found containing an OwinStartupAttribute.
- No assembly found containing a Startup or [AssemblyName].Startup class.
To disable OWIN startup discovery, add the appSetting owin:AutomaticAppStartup with a value of "false" in your web.config.
To specify the OWIN startup Assembly, Class, or Method, add the appSetting owin:AppStartup with the fully qualified startup class or configuration method name in your web.config.
When you deleted the Alloy project you probably removed all necessary start-up code, e.g. the class called startup.cs which contains all the Owin configuration.
You've started quite many different threads about your issue so really hard to follow which one is active ;-)
1# If you add multiplte Episerver projects to a Visual Studio solution by default the projects don't share anything between each other. They have separate databases, look at web.congig 'connectionstring' element
2# When you create a new epmty Episerver project, it doesn't use ASP.Net Identity BUT ASP.Net memebership&rolemanager (look at web.config, authentication mode is 'Forms' and you have the entries membership (defaultProvider=MultiplexingMembershipProvider) and roleManager (defaultProvider=MultiplexingRoleProvider). The Multiplexing***Provider is a special provider that can combine different providers but only one of those is used to create new entries, other providers are used only for reading (sorry this might confuse you for now). So in the default setup these multiplexing ones use SQL server based providers + Windows, which means that you can for example use your local (or domain) account to sign in (but it needs to be a member of the local Administrator group, which you already have noticed in some other thread). => and now to the startup.cs not being there, it shouldn't because that is used in ASP.Net identity authentication, so that is the reason why there is no startup.cs generated by the Episerver project template (and besides the file name could be anything because it is not about file name but OWIN startup).
So if you can't use your windows account to login, you can always create a simple create-account.aspx and in that create a default admin user to the SQL membership, see the API documentation in MSDN. Then start your project in Visual Studio and go to this "secret" aspx page and it creates the account for you and then you can login using that account (just remember that you don't deploy this file to a test or production environment ;-) ).
While doing this, you could actually change the membership and roleManager to not support Windows at all:
And as a side note, the ASP.Net Identity is the more modern way to do it, so maybe you should just actually just switch to it. Create empty Episerver project and then another Alloy project (which uses Identity) and then compare the web.config files to see the difference in the configuration and then copy the Identity code from the Alloy project to your empty project and You should get the Identity based authentication to work in your project (in Alloy project you are mainly interested of the Startup.cs (owin magic happens in this file, the assembly: OwinStartup(xxxx) attribute) and AdministratorRegistrationPage.cs)