Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Ph47
Created January 20, 2015 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ph47/fb78936df0786e5c0f2a to your computer and use it in GitHub Desktop.
Save Ph47/fb78936df0786e5c0f2a to your computer and use it in GitHub Desktop.
About DependencyInjection issue
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"exclude": [
"wwwroot"
],
"packExclude": [
"**.kproj",
"**.user",
"**.vspscc"
],
"dependencies": {
"Api": "1.0.0-*",
"Model": "1.0.0-*",
"DiscoverPackageSources": "0.1.27",
"Microsoft.AspNet.StaticFiles": "1.0.0-*",
"Microsoft.AspNet.Mvc": "6.0.0-*",
"Microsoft.AspNet.Server.WebListener": "1.0.0-*",
"Microsoft.AspNet.Hosting": "1.0.0-*",
"Microsoft.Framework.ConfigurationModel": "1.0.0.0-beta3-10726",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-*",
"Thinktecture.IdentityServer.v3": "1.0.0-*",
"Thinktecture.IdentityServer.v3.AspNetIdentity": "1.0.0-*",
"Thinktecture.IdentityModel.Core": "1.3.0",
"Thinktecture.IdentityManager": "1.0.0-*",
"Thinktecture.IdentityManager.AspNetIdentity": "1.0.0-*",
"Microsoft.AspNet.Identity.Core": "2.1.0",
"Microsoft.AspNet.Identity.Owin": "2.1.0",
"Microsoft.AspNet.Identity.EntityFramework": "2.1.0",
"Microsoft.AspNet.Owin": "1.0.0-*",
"Microsoft.Owin": "3.0.0",
"EntityFramework": "6.1.2.0",
"Microsoft.Framework.DependencyInjection": "1.0.0.0-*"
},
"frameworks": {
"aspnet50": { }
},
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5001"
}
}
using Microsoft.AspNet.Builder;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.AspNet.Hosting;
using Microsoft.Framework.DependencyInjection;
using Memorialis.Model;
using Microsoft.AspNet.Routing;
using Memorialis.Web.Utility;
using Memorialis.Identity;
namespace Memorialis.Web
{
public class Startup
{
public IConfiguration Configuration { get; set; }
public Startup()
{
// Setup configuration sources.
Configuration = new Configuration()
.AddJsonFile("config.json")
.AddEnvironmentVariables();
}
/// <summary>
/// Dependencies loading
/// </summary>
/// <param name="services">Collection of services</param>
public void ConfigureServices(IServiceCollection services)
{
// Configure EF to use SQL server for primary Memorialis Context
services.AddEntityFramework(Configuration)
.AddSqlServer()
.AddDbContext<Context>();
// Configure MVC
services.AddMvc();
}
/// <summary>
/// Middleware loading
/// </summary>
public void Configure(IApplicationBuilder app)
{
// Enable Identity Server
app.Map("/id", _ => _.UseIdentityServer(IdentityServerConfig.Config()));
// Enable Identity Manager
app.Map("/idm", _ => _.UseIdentityManager(IdentityManagerConfig.Config()));
// Enable static files
app.UseStaticFiles();
// Enable MVC for API hosting and server-based pages
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller}/{action}/{id?}",
defaults: new { controller = "Home", action = "Index" });
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment