Codechef4u is a community for computer professionals,by computer professionals,just like you; who loves sharing and helping each others,Join them
Share your post

Unable to start debugging, stops application pool

Error:

Unable to start debugging on the web server. Could not start ASP.NET debugging.



Fix:

If you are facing this issue and websites stops application pool then this is permission issue.
Check all websites associated with has permission (if required admin permission provide that).
Ensure your website using domain account and require admin permission.

Example:

You was using an application pool that that used a domain account. Windows on your computer wanted to make a profile for this user and wasn't able to do so due to a permissions problem.

ASP.NET 5

In this article I will explain in detail latest Asp.net 5 preview release.Asp.net era started with first preview release ASP.NET 1.0 around 15 years ago, millions of developers have used it to build and run web applications, and over the years Microsoft added great features in asp.net.

ASP.NET 5:

ASP.NET 5 is a significant change of ASP.NET, in this article I will introduce you asp.net 5 purviews.
ASP.NET 5 is a new open-source and cross-platform framework for building modern cloud-based Web apps. using .NET.
You can develop and run your ASP.NET 5 applications cross-platform on Windows, Mac and Linux.
Asp.net open source code is available in GitHub.

 

Some new features with asp.net 5:

1.  New light-weight and modular HTTP request pipeline

2.  Ability to host on IIS or self-host in your own process

3.  Built on .NET Core, which supports true side-by-side app versioning

4.  Ships entirely as NuGet packages

5.  Integrated support for creating and using NuGet packages

6.  Single aligned web stack for Web UI and Web APIs

7.  Cloud-ready environment-based configuration

8.  Built-in support for dependency injection

9.  New tooling that simplifies modern web development

10. Build and run cross-platform ASP.NET apps on Windows, Mac and Linux

12. Open source and community focused

 

.NET Execution Environment (DNX):

ASP.NET 5/DNX is a lean .NET stack for building modern cloud and web apps that run on OS X, Linux, and Windows.
Microsoft team making number of changes of architectural changes that makes the core web framework much leaner (it no longer requires System.Web.dll).
SP.NET 5 applications are built and run using the new .NET Execution Environment (DNX). Every ASP.NET 5 project is a DNX project.

Every asp.net 5 applications defined using a public start-up class:

Sample example:

       public class Startup
        {
           
public void ConfigureServices(IServiceCollection myservices)
            {
            }
 
           
public void Configure(IApplicationBuilder myapp)
            {
            }
        }

 

ConfigureServices: Method used to define services used by your application.

Configure: Method used to define what middleware makes up your request pipeline.

Service:

Service is a component available through dependency injection. Services in ASP.NET 5 come in three varieties: singleton, scoped and transient. Transient services are created each time they’re requested from the container. Scoped services are created only if they don’t already exist in the current scope. For Web applications, a container scope is created for each request, so you can think of scoped services as per request. Singleton services are only ever created once.  

Servers:

ASP.NET 5 includes server support for running on IIS or self-hosting in your own process. You can use cross platform servers also to host your ASP.NET 5 web application.

Web Root:

The Web root of an ASP.NET 5 application is configured using the “webroot” property in your project.json file.

Client-side development: 

Asp.net 5 supports or you can integrate seamlessly with a variety of client-side frameworks like Bootstrap,AngularJS,KnouckoutJS.

Configuration: 

Asp.net 5 new configuration model is not based on System.Configuration or Web.config. This new configuration model pulls from an ordered set of configuration providers. The built-in configuration providers support a variety of file formats (XML, JSON, INI) and also environment variables to enable environment-based configuration. You can also write your own custom configuration providers. 

 

ASP.NET MVC

What is MVC?

MVC stands for Model-View-Controller. It is a software architectural design pattern which was introduced in 1970s.

MVC separates the representation and the user interaction.

MVC is divided in to three sections:

View:  Responsible for look and feel.
Model: Represents the real world object and provides data to the “View”.
Controller:  Responsible to take the end user request and load the appropriate   “Model” and “View”.

Detailed Description:

Model – The Model represents a set of classes that describe the business logic i.e. business model as well as data access operations i.e. data model. It also defines business rules for data means how the data can be changed and manipulated.

View – The View represents the UI components like CSS, jQuery, html etc. It is only responsible for displaying the data that is received from the controller as the result. This also transforms the model(s) into UI.

Controller – The Controller is responsible to process incoming requests. It receives input from users via the View, then process the user’s data with the help of Model and passing the results back to the View. Typically, it acts as the coordinator between the View and the Model.

Example:

Model:

public class Company
    {
        [Key]
        public Int16 CmpId { get; set; }
 
        [Required(ErrorMessage = "Name is required")]
        [StringLength(150)]
        [RegularExpression("^[A-Za-z0-9][A-Za-z0-9_ .-]*", ErrorMessage = "Invalid company name")]
        public string CmpName { get; set; }
 
        [Required(ErrorMessage = "Regestration number is required")]
        [StringLength(150)]
        public string CmpRegestration { get; set; }
 
        [Required(ErrorMessage = "Key peoples required")]
        public string CmpKeypersons { get; set; }
 
        [StringLength(2000)]
        public string Description { get; set; }
 
        [DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)]
        [Required(ErrorMessage = "Registration Date is required")]
        public DateTime CmpRegDate { get; set; }
 
        [Required(ErrorMessage = "Email is required")]
        [DataType(DataType.EmailAddress)]
        public string CmpEmail { get; set; }
 
        public Guid CreatedBy { get; set; }
 
        [ForeignKey("CreatedBy")]
        public aspnet_Users User { get; set; }
 
        [DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)]
        public DateTime? CreatedDate { get; set; }
 
        [DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)]
        public DateTime UpdateDate { get; set; }
 
        public string UpdateBy { get; set; }
    }

View:

@model IEnumerable<BlogProj.Models.Company>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="../../MyScripts/jquery-ui.js" type="text/javascript"></script>
<link href="../../Content/themes/demos.css" rel="stylesheet" type="text/css" />
 
<div style="height:25px"></div>
  <fieldset class="ui-widget-content" style="text-align:center">
        <legend>  @Html.ActionLink("Create New", "Create")</legend>
 
        <div style="height:20px"></div>
<table class="ui-widget-content" style="border-spacing:0px" style="border-spacing:0px">
    <tr class="ui-widget-header">
    <th></th>
        <th>
            Id
        </th>
        <th>
           Name
        </th>
        <th>
            Reg Date
        </th>
         <th>
            RegestrationId
        </th>
         <th>
           Key Persons
        </th>
    
         <th>
           Created By 
        </th>
         <th>
         Created Date
        </th>
        <th>
         Actions
        </th>
    </tr>
 
@foreach (var item in Model)
{
    <tr>
    <td></td>
    <td>
            @Html.DisplayFor(modelItem => item.CmpId)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CmpName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CmpRegDate)
        </td>
       
          <td>
            @Html.DisplayFor(modelItem => item.CmpRegestration)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CmpKeypersons)
        </td>
          <td>
            @Html.DisplayFor(modelItem => item.User.UserName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CreatedDate)
        </td>
 
        <td>
            @Html.ActionLink("Edit", "Edit", new { id = item.CmpId }) |
            @*@Html.ActionLink("Details", "Detail", new { id = item.CmpId }) |*@
            @Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
        </td>
   </tr>
   
}
</table>
</fieldset>

 

Controller:

 

Namespace CodeChef4uLeave.Controllers
{
    public class CompanyController : Controller
    {
        private UnituOfWork unitOfWork = new UnituOfWork();
        //
        // GET: /Leave/
 
        public ActionResult Index()
        {
            var Companies = unitOfWork.GetAllCompanies();
            return View(Companies);
       
        }
   }
}