Tag Archives: cheap windows ASP.NET Core 1.0 hosting

ByAlexia Pamelov

Cheap Windows ASP.NET Core 1.0 Hosting With ASPHostPortal.com

CheapWindowsHosting.com | Cheap and Reliable ASP.NET Core 1.0 hosting. A significant problem with the new versions of ASP.NET is that they aren’t backwards compatible with previous versions. This isn’t just a matter of having slightly different behaviors or APIs, but this is essentially a complete rewrite with a significant amount of functionality being dropped. To eliminate this problem, Microsoft is starting the numbering scheme.  The new versions will be called ASP.NET Core 1.0. ASP.NET Core 1.0 is not a continuation of ASP.NET 4.6. It is a whole new framework, a side-by-side project which is an actual re-write of the current ASP.NET 4.6 framework, but much smaller and a lot more modular. To help ASP.NET developers and users find a good home for their websites, we have reviewed the following top 3 hosting providers who stand out as the best and recommended ASP.NET Core 1.0 hosting for .NET developers.

What’s ASP.NET Core 1.0 Hosting?

Microsoft announced that what has so far been ASP.NET 5 has been renamed to ASP.NET Core 1.0. Microsoft went this route and made it very clear that this version of ASP.NET is a totally new platform to build applications from and not just a small upgrade as prior upgrades from say ASP.NET 3 to 4 have been. ASP.NET Core is a brand new platform that has been rebuilt from the ground up – all the way to the core .NET platform libraries – to provide a leaner and cross platform implementation on what was ASP.NET. While there is a lot of feature compatibility with older versions, it does not have what you would call code compatibility meaning that you can’t just run your old ASP.NET code in ASP.NET Core without a fair bit of change.

cheap-aspnet-core-1-0-hosting_zpsk9oqwzps

With ASP.NET Core 1.0 we are making a number of architectural changes that make the core web framework much leaner and more modular. ASP.NET Core 1.0 is no longer based on System.Web.dll, but is instead based on a set of granular and well factored NuGet packages allowing you to optimize your app to have just what you need. You can reduce the surface area of your application to improve security, reduce your servicing burden and also to improve performance in a true pay-for-what-you-use model.

Which One is The Best & Recommended ASP.NET Core 1.o Hosting ?

Our best and recommended ASP.NET Core 1.0 hosting in US goes to ASPHosPortal.com Windows hosting plan for it’s unlimited features, affordable price, great reliability, friendly tech support and leading server platforms after evaluation over 30+ popular ASP.NET Core 1.0 hosting providers in USA.

Tips To Select Best and Recommended ASP.NET Core 1.0 Hosting

When you’re looking for best and recommended ASP.NET Core 1.0 hosting, you have to ensure that your hosting plan supports and does have one new MSSQL 2008 database, MSSQL 2012 database or MSSQL 2014 database available for the installation. Without the accessibility of the MSSQL database, the free installation will not work and your ASP.NET Core 1.0 cannot be installed. It also requires Windows 2008 hosting with IIS 7.0 hosting compatible or Windows 2012 hosting with IIS 8.0 hosting and above. Here are some highlight tips to select best and recommended ASP.NET Core 1.0 hosting:

  • Server PlatFrom : ASP.NET Core 1.0 hosting should be configured on the latest Windows Server platform, Server 2008 is minimum requirement for today’s windows hosting service. 2012 should be your final attention since it’s the latest OS.
  • Hosting Features : It must come with most essential functionalities such as multiple ASP.NET frameworks, custom trust level support and SQL Server support etc. It should also come with sufficient disk space and data transfer abilities for different websites requirement.
  • Technical Support : Technical support is the most essential point when looking for the best and recommended ASP.NET Core 1.0 hosting provider. You can’t tell when you will need assistance from the support team or some basic urgent assistance such as data recovery.

ASP.NET Core 1.0 Hosting with ASPHostPortal.com

ASPHostPortal.com is Microsoft No #1 Recommended Windows and ASP.NET Spotlight Hosting Partner in United States. They provide a lot of kind web hosting types such as: Windows hosting, Linux hosting, reseller hosting and many more. As a technology focused web host, their web hosting packages are designed to support popular web development technologies. Windows and ASP.NET 5 hosting are at the core of our business practice. Also, they have over 10 years combined experience in .NET, PHP, Network Administration, System Integration and related technologies to support mission critical hosting for applications built on these platforms. Their service is trusted worldwide and they have served more than 10,000 customers in 5 different continents.

ASPHostPortal.com offers ASP.NET Core 1.0 Hosting with an interested hosting plan. They support this new technology with affordable price, a lot of ASP.NET features, 99.99% uptime guarantee, 24/7 support, and 30 days money back guarantee. They strive to make sure that all customers have the finest web-hosting experience as possible. To learn more about their ASP.NET Core 1.0 Hosting, please visit http://asphostportal.com/

ByAlexia Pamelov

Cheap Windows ASP.NET Hosting – How to Diagnostics in ASP.NET Core 1.0

CheapWindowsHosting.com | Cheap and reliable windows ASP.NET hosting. In this post we will Using Diagnostics in ASP.NET MVC 6 (Core 1.0), we will see how to easily sort out coding issue in a sample application.

The ASP.NET Core 1.0 release (currently in RC1) provides several new features as well as improvements to existing features. One such very useful feature is Diagnostics. ASP.NET Core a.k.a ASP.NET 5 simplifies diagnostics. In this article, we will go through the Diagnostics feature and see how to implement it in an ASP.NET MVC 6 application.

Implementing Diagnostics in ASP.NET MVC 6

This application is implemented using Visual Studio 2015 and ASP.NET Core 1.0.

  • Step 1: Open Visual Studio 2015 and create a new ASP.NET Web Application from Add New Project window. Click on OK and select Empty from ASP.NET 5 Templates. Click on OK to create the project.
  • Step 2: In this project, open the project.json file and add the following dependencies in the dependencies section
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
"Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final"

This will add the necessary references in the project.

  • Step 3: In the project, add a Models folder and in this folder add ModelClasses.cs. Add the following code in this class file
using System.Collections.Generic;
namespace ASPNET_Core_Diagnistics.Models
{
    public class Employee
    {
        public int EmpNo { get; set; }
        public string EmpName { get; set; }
    }
    public class EmployeesDatabase : List<Employee>
    {
        public EmployeesDatabase()
        {
            Add(new Employee() { EmpNo = 1, EmpName = "A" });
            Add(new Employee() { EmpNo = 2, EmpName = "B" });
            Add(new Employee() { EmpNo = 3, EmpName = "C" });
            Add(new Employee() { EmpNo = 4, EmpName = "D" });
            Add(new Employee() { EmpNo = 5, EmpName = "E" });
            Add(new Employee() { EmpNo = 6, EmpName = "F" });
        }
    }
    public class DataAccess
    {
        public List<Employee> Get()
        {
            return new EmployeesDatabase();
        }
    }
}

The above code contains the entity class of name Employee and the EmployeesDatabase class contains some Employee records in it. The DataAccess class contains Get() method and returns EmployeesDatabase class instance.

  • Step 4: In this folder, add a new folder of name Services. In the Services folder, add the class file of name Services. Add the following code in it
using ASPNET_Core_Diagnistics.Models;
using System.Collections.Generic;
 
namespace ASPNET_Core_Diagnistics.Services
{
    public interface IService<T> where T :class
    {
        IEnumerable<T> Get();
    }
 
    public class EmployeeService : IService<Employee>
    {
        DataAccess ds;
        public EmployeeService(DataAccess d)
        {
            ds = d;
        }
        public IEnumerable<Employee> Get()
        {
            return ds.Get();
        }
    }
}

The above code contains an interface of name IService<T> where T is the type. The EmployeeService implements IService interface. The constructor of EmployeeService is injected with the DataAccess object.

  • Step 5: In the same project, add a Controllers folder and in this folder add a MVC Controller Class using Add > New Item > MVC Controller class. By default, the name of the controller class is HomeController, rename it to EmployeeController.
  • Step 6: In the Startup.cs we need to define the required configuration. We will use the inbuilt dependency injection feature of ASP.NET Core 1.0. Add the following code in the ConfigureServices() method of the Startup.cs class
public void ConfigureServices(IServiceCollection services)
{
    services.AddMvc();
    services.AddSingleton<IService<Employee>, EmployeeService>();
}
Step 7: To use MVC we need to define routing for the application, add the following code in the Configure() method of the Startup class
public void Configure(IApplicationBuilder app)
{
    app.UseIISPlatformHandler();
    app.UseStaticFiles();
    app.UseMvc(routes =>
    {
        routes.MapRoute(
            name: "default",
            template: "{controller=Employee}/{action=Index}/{id?}");
    });
}
  • Step 8: Now add a new folder of name Views to the project. In this folder add a new sub-folder of name Employee. In the Views folder, add a new MVC View Imports Page and add the following code in it
@using ASPNET_Core_Diagnostics;
@using ASPNET_Core_Diagnostics.Models;
@addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers"

This will be used to execute new asp- attribute in MVC Views.

Step 9: In the Employee subfolder of Views folder, add a new MVC View of name Index.cshtml and add the following markup code in it

@model IEnumerable<ASPNET_Core_Diagnostics.Models.Employee>
@{
    ViewData["Title"] = "Index";
}
 
<h2>Index</h2>
<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.EmpNo)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.EmpName)
        </th>
        <th></th>
    </tr>
 
    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.EmpNo)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.EmpName)
            </td>
        </tr>
    }
</table>
  • Step 10: Running the application

Run the application, the following result will be displayed

aspnet-error-500

This shows a generic Error 500, let us find out the exact error. We can do this by using Microsoft.AspNet.Diagnostics. Add this namespace in the Startup.cs. In the Configure() method add the following code (highlighted)

public void Configure(IApplicationBuilder app,IHostingEnvironment environment)
{
    app.UseIISPlatformHandler();
    if (string.Equals(environment.EnvironmentName, "Development", StringComparison.OrdinalIgnoreCase))
    {
        app.UseDeveloperExceptionPage();    
    }
    app.UseStaticFiles();
    app.UseMvc(routes =>
    {
        routes.MapRoute(
            name: "default",
            template: "{controller=Employee}/{action=Index}/{id?}");
    });
 
}

The above code uses an if statement to check the EnvironmentName, this is used to verify the current mode in which the application is running. Currently we are using development mode. The UseDeveloperException() extension method is used to render the exception during the development mode.

Run the application and the following result will be displayed:

exception-page

This shows the stack trace error. In our scenario it shows the Object reference is not set to an instance of object. It shows that the foreach loop is not working. This is the problem of the Index() action method of the EmployeeController. Change the code as following

public class EmployeeController : Controller
{
    IService<Employee> _service;
    public EmployeeController(IService<Employee> srv)
    {
        _service = srv;
    }
    // GET: /<controller>/
    public IActionResult Index()
    {
        var Emps = _service.Get();
        return View(Emps);
    }
}

We are injecting the IService<Employee> in the EmployeeController constructor. The Index() action method is calling the Get() method of the IService.

Run the following application, the following result will be displayed

aspnet-diagnostics-dataaccess

The above error shows the Unable to resolve the DataAccess error. To resolve this, let’s verify the code of EmployeeService class. In the constructor, we are passing the dependency of DataAccess but we have not registered it in the ConfgureServices() method. Add the following code in the ConfgureServices() method.

public void ConfigureServices(IServiceCollection services)
{
    services.AddMvc();
    services.AddScoped(typeof(DataAccess));
    services.AddSingleton<IService<Employee>, EmployeeService>();
}

We have added the DataAccess as a dependency in the application.

 

Simpan