Yeay!! .NET Core 1.0 has been released. We know that some of people think it is on RC version but Microsoft has fully released it via their official site. In previous article, we have written about article how to publish ASP.NET Core 1.0 on shared hosting environment. In this article, we only write small introduction about ASP.NET Core 1.0.
So, what’s ASP.NET Core 1?
It consists of many modular components which means minimal overhead. It’s no longer based on the infamous System.Web.dll but rather has become a bunch of NuGet packages where you can cherry-pick only the libraries that you actually need. ASP.NET Core 1.0 now has a unified and single aligned stack for Web UI and Web API with integrated client-side development. It offers cloud-ready environment based configuration and ability to be hosted on both IIS or your own process. The new and lightweight HTTP request pipeline is very modular and gives the developer complete control!
.NET Core 1.0 is a small optimized runtime that is very modular and portable. It include a subset of the traditional .NET Framework libraries and can be packaged and deployed together with your application. Then you could do side-by-side app hosting using different versions of .NET for example.
Requirement for ASP.NET Core 1.0
Please install this nugget package into each of your projects. Just visit Autofac.Extensions.DependencyInjection
Startup.cs
Next, let’s build our services container and tell ASP.NET to use it.
// This method gets called by the runtime. Use this method to add services to the container. public IServiceProvider ConfigureServices(IServiceCollection services) { // Add framework services. services.AddEntityFramework() .AddSqlServer() .AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"])); services.AddIdentity<ApplicationUser, IdentityRole>() .AddEntityFrameworkStores<ApplicationDbContext>() .AddDefaultTokenProviders(); services.AddMvc(); // Add application services. services.AddTransient<IEmailSender, AuthMessageSender>(); services.AddTransient<ISmsSender, AuthMessageSender>(); var builder = new ContainerBuilder(); builder.RegisterModule<DataModule>(); builder.RegisterType<SeedDataService>().As<ISeedDataService>(); builder.Populate(services); var container = builder.Build(); return container.Resolve<IServiceProvider>(); }
Let’s break down what’s happening here:
- You have to change the return type from void to IServiceProvider. This lets ASP.NET know to use your container instead of the built in one.
- Entity Framework, Identity and MVC are added using the built in methods. Note that the context is set up as InstancePerRequest for you.
- We’ve left the transient email and sms sender services there just to show you that you can mix the built-in container and your own. (Thanks to builder.Populate).
- You register your services with Autofac as normal, except you also use builder.Populate() to add any services that were added to the built-in container.
- Build the container and return an instance of IServiceProvider back to ASP.NET.
That’ complete. It’s simple, right?
Hosting Provider that Offer ASP.NET Core 1.0
That’s only few hosting provider that support ASP.NET Core 1.0 hosting. We have reviewed more than 20-30 windows hosting provider, they don’t officially support ASP.NET Core on their hosting environment. Here are few hosting provider that offer ASP.NET Core 1.0 hosting that we would recommend:
ASPHostPortal ASP.NET Core 1.0 Hosting
ASPHostPortal is one of top windows hosting provider that already support ASP.NET Core 1.0 on their hosting environment. They offer various web hosting services start from very affordable pricing, Host One, Host Two, Host Three, and Host Four. Host One plan start with $5.00/month. Host Two start with $9.00/month, Host Three is the most favorite plan start from $14.00/month and Host Four start with $23.00/month.
We have tried to find the confirmation that they have support this latest ASP.NET Core 1, here are few examples that most of users recommend their hosting services on forums.asp.net
For more information, please just visit their official site at http://www.asphostportal.com
ASP.NET Core 1.0 Hosting with HostForLIFEASP.NET
HostForLIFEASP.NET is other great recommendation for ASP.NET Core 1.0 hosting. They have powerful server in Europe that you can rely on. Customer can choose their Paris, London, Frankfurt, Amsterdam, and also their newest Italy datacenters if customer sign up for their hosting plan.
HostForLIFEASP.NET Classic plan start from €3.00/month, Budget plan from €5.50/month, Economy plan from €8.00/month. And the powerful plan named Business plan from €11.00/month. A 30-day money back guarantee is provided to eliminate purchasing risks.
For more information, please visit their official site at https://hostforlifeasp.net/
[crp]