Publish ASPNET 5 MVC 6 on IIS

Using Visual Studio 2015 Preview CTP6.

  1. Create an ASP .NET 5 New App
  2. Check that it is working outside of IIS.
  3. Once complete, publish the application. In this example, I have selected the location C:\MyPublishFolder
    1. When publishing your application, make sure that you have:
    2. Disabled pre-compilation
    3. Selected kre-clr-win-x64.1.0.0-beta3 OR kre-clr-win-x86.1.0.0-beta3 (See image below)

      Publish Screen shot
      Publish Screen shot
    4. Upon a successful publish, go to C:\MyPublishFolder.You should see the folders approot and wwwroot inside.
    5. Now open the IIS Manager (I am assuming you have the ASP .NET 4.5 feature enabled) with IIS 8.5
    6. Create a new website.
      1. Select the wwwrooot folder as the website’s physical path. In this example, it is C:\MyPublishFolder\wwwroot.
    7. Now check the website it is working

If the precompile option is ticked in the Publish Web Settings window pictured above, then you must

  1. Go to the wwwroot folder of your published web application. It is C:\MyPublishFolder\wwwroot
  2. Locate web.config
  3. Inside the folder of your published application, there is a packages folder inside of the approot folder which is contain a folder named after your application, with a folder for the version underneath. Inside that folder should be a folder named root. In web.config, set the value for the key kre-app-base to the root folder. For reference, see the line of code below. In this example, the application name is TestApplication.
  4. <add key=”kre-app-base” value=”..\approot\packages\ TestApplication \1.0.0\root” /> (See image below)
Published Web.Config
Published Web.Config

(#3) ASP.Net Core + Angular 2 … don’t waste your Razor

some assembly required, batteries not included

When serving up Angular 2 script and views, some people have chosen node.js or ASP.Net core server solutions that pre-render data into the angular views being delivered to the client, other implementations go the other way, adopting a simpler philosophy of just serving ‘flat’ unmodified script and HTML views. A few have gone part way, using webpack to collect bundles of views, styles and code. A few rely on ASP.Net Core to serve data using Web API and generally do not use Razor syntax, Tag Helpers or anything much of ASP.Net Cores’ features.

This series of posts will describe a middle ground, where we’ll leverage as much of ASP.Net Core as we can, give users the responsiveness that comes with Angular – delivering data from Web API and caching views where practical.

In the last step we added Angular, served from flat HTML, and had to browse index.html. Now we switch…

View original post 535 more words

Building an Angular2 SPA with ASP.NET Core 1.0, MVC 6, Web API 2, and TypeScript 1.7.5

IEvangelist

Overview

The purpose of this post is to establish ourselves with a working environment geared towards development on ASP.NET Core 1.0 through Visual Studio 2015. I will walk through creating an Angular2 Single Page Application with MVC 6, Web API 2 and TypeScript. The sample application is available here on my github page.

View original post 2,561 more words

Web API File Uploading (Desktop and Web client)

chsakell's Blog

File uploading is one of the most common tasks all developers have to deal with, at some point of their application development cycle. For example, Web applications (such as social networks) usually require users to upload a profile picture during registration or in the case of desktop ones, users may required to upload private documents.
This post will show you how to upload multipart/form-data files using Web API with both Web and Desktop clients. More particular here’s what we gonna see:

  • Web API File Upload Controller: Create an action for Uploading multipart-form data
  • Web client: Create an AngularJS web client to upload multiple files at once using the Angular File Upload module
  • Desktop client: Create an Windows Form client to upload multiple files using HttpClient

Let’s start:

The Controller

Create a solution named WebApiFileUpload and add a new empty Web Application named WebApiFileUpload.API selecting both the Web…

View original post 465 more words

DNVM Commands

Install or Upgrade DNVM Using CMD:

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "&{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}"

Install or Upgrade DNVM Using Powershell:

&{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}

Run DNVM without Arguments:

> dnvm

List Available DNX Runtimes Using DNVM List:

> dnvm list

DNVM Install Latest:

> dnvm install latest

DNVM Install Latest for Specific Runtime/Architecture:

> dnvm install latest -r coreclr -arch x64

Upgrade .NET Framework CLR to Latest Version Using DNVM Upgrade:

> dnvm upgrade -r clr -arch x64

Upgrading to Latest Unstable (development) Runtime Releases:

> dnvm upgrade –u

Select or Switch to a Different Runtime for the Current Process:

&gt; dnvm use 1.0.0-beta4-11566 -r coreclr -arch x64

Select or Switch to a New DNX Runtime Default for User PATH:

> dnvm use 1.0.0-beta4-11566 -r coreclr -arch x64 -p

Remove DNX Runtime References from Process PATH Variable:

> dnvm use none

Remove DNX Runtime References from User PATH Variable:

> dnvm use none –p

Assign an Alias to a DNX Runtime:

> dnvm alias core-64-latest 1.0.0-beta4-11566 -r coreclr -arch x64

Select or Switch to a new DNX Runtime Using an Alias:

> dnvm use core-64-latest

Use DNU Restore to Restore Library Package Dependencies:

C:\Users\Jitendra\dotnet_demo> dnu restore

Run the Application Using DNX:

C:\Users\Jitendra\dotnet_demo> dnx . runme

Run the Application by Referencing the Project Directory Name:

C:\Users\Jitendra\dotnet_demo> dnx . dnx_demo

Run the Application Using dnx . run:

C:\Users\Jitendra\dotnet_demo> dnx . run

Switch to the .NET Framework Runtime Using DNVM Use:

C:\Users\Jitendra\dotnet_demo> dnvm use default

EF7 Migrations DNX Commands

Installing

Install-Package EntityFramework.Commands -Version 7.0.0-beta5 -Pre 

{
    "dependencies": {
        "EntityFramework.Commands": "7.0.0-beta5"
    },
    "commands": {
        "ef": "EntityFramework.Commands"
    }
}

Once you have done this, you should be able to restore packages, change directory into your project (the directory containing the project.json file), and run the command.

dnu restore
cd src\apnetTestApp
dnx . ef

ef

Using
To see all the sub-commands are available for the migration command, type dnx . ef migration --help. For now, there are five commands

  • add–Add a new migration
  • apply–Apply migrations to the database
  • list–List the migrations
  • script–Generate a SQL script from migrations
  • remove–Remove the last migration

To see the usage of the add command, type dnx . ef migration add --help.
To add a new migration, type dnx . ef migration add “migration name”.

Summary
In this way we will be able to add, apply migration in entity framework 7, after changing the name of commands.