35

I want to host my ASP.NET 5 project which uses MVC 6 and Entity Framework 7 on Amazon free micro instance. I can't find any step-by-step manual on how to host ASP.NET 5 projects on IIS, all materials just mention that this is possible but without any guides.

Basically, I'm deploying to local folder and then copying to newly created site, but nothing is working.

Unfortunately, I can't use Azure as it only has one month free trial, not a year.

starball
  • 20,030
  • 7
  • 43
  • 238
Sergey Sypalo
  • 1,223
  • 5
  • 16
  • 35

5 Answers5

23

I'm using Visual Studio 2015 Preview to create ASP.NET 5 projects. I don't think that's difficult to deploy on IIS now. First publish your website by publishing it as file system in VS 2015 preview, then copy the published folder to your server, create an application in IIS and set the application folder to the wwwroot folder (rather than the root folder), that's all. Be aware, check if "Microsoft.AspNet.Server.IIS" exists in your website project.json before publishing it.

Edit: there should be a web.config in wwwroot folder, the content of web.config may be like this (with precompile option when publishing):

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <add key="kpm-package-path" value="..\approot\packages" />
    <add key="bootstrapper-version" value="1.0.0-beta1" />
    <add key="kre-package-path" value="..\approot\packages" />
    <add key="kre-version" value="1.0.0-beta1" />
    <add key="kre-clr" value="CoreCLR" />
    <add key="kre-app-base" value="..\approot\packages\Rvc.PopUpSite\1.0.0\root" />
  </appSettings>
</configuration>

or like this (without precompile option):

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <add key="kpm-package-path" value="..\approot\packages" />
    <add key="bootstrapper-version" value="1.0.0-beta1" />
    <add key="kre-package-path" value="..\approot\packages" />
    <add key="kre-version" value="1.0.0-beta1" />
    <add key="kre-clr" value="CoreCLR" />
    <add key="kre-app-base" value="..\approot\src\Rvc.PopUpSite" />
  </appSettings>
</configuration>

Please notice the value of kre-app-base. Occasionally its value is empty string after publishing in Visual Studio.

vcsjones
  • 138,677
  • 31
  • 291
  • 286
Ricky
  • 10,044
  • 3
  • 26
  • 31
  • Hi Ricky, just tried as you said copy published folder to Amazon, so I have my site in C:\Inetpub\wwwroot\Blog on Amazon, created new site in IIS, pointed it to C:\Inetpub\wwwroot\Blog\wwwroot, but it's not working. I have "Microsoft.AspNet.Server.IIS" in roject json. Any Ideas what I'm doing wrong? – Sergey Sypalo Dec 19 '14 at 15:05
  • @Sergey just edited my post. I don't know if you can get notification of my edit, so added this comment. It would also be very helpful if you could post the error message you got, if any. – Ricky Dec 20 '14 at 09:43
  • Hi Ricky, thx, now it's working. Faced another issue, after changing packages in project.json from *beta-1 to *rc-1, during publishing to local disk both versions are published, do you know how to remove old dependencies? – Sergey Sypalo Dec 22 '14 at 20:43
  • The ```kre-app-base``` value being empty was the root of all the problems I was having with this. Thanks! – Dylan Parry Feb 23 '15 at 17:34
  • 2
    kre has been renamed to dnx – Stefan Steiger Aug 18 '15 at 11:50
  • I had to publish my wwwroot not in the (very long) default directory from the publish wizard. The path / file names became too long. – toddmo Sep 01 '15 at 22:33
3

1. First you need to publish the site to the file system:

visual studio 2015 publish window

2. Create a new application in IIS:

Add website IIS manager button Add website IIS manager window

3. Unzip the file you've created in step 1 in the website directory from step 2. The folder should look like:

enter image description here

4. You may also need to install DNVM (formerly KVM) and the DNX Runtime Environment (formerly KRE):

Install the DNVM - dotnet version Manager (KVM)

Install the DNX runtime environment inside DNVM (KRE)

Warren P
  • 65,725
  • 40
  • 181
  • 316
Nikolay Kostov
  • 16,433
  • 23
  • 85
  • 123
  • Hi Nikolay, first 3 steps already done, so I've just installed KVM and was unable to run "kvm upgrade" command until changed path to C:\Users\Administrator\.kre\bin> After this I was able to run "kvm upgrade comand" but result the same, when I'm trying to open web pageI'm receiving following error: HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory – Sergey Sypalo Dec 06 '14 at 16:33
3

I had the same problem with DNX Beta 4.

If someone has the same problem :

You have to target x64 framework (Target DNX Version) when you publish your website in Visual Studio 2015 RC and write "XXX\wwwroot" in Physical Path in your IIS website configuration.

orrel
  • 248
  • 2
  • 6
1

You can use the File system publish method. Follow these steps:
1/ Generate in a folder with Visual studio the .dll files
2/ Create a website in IIS manager and give in the path to your folder

AnotherGeek
  • 874
  • 1
  • 6
  • 24
1

I found what I've missed, I need to change url to my public DNS in projct.json file:

"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://ec2-54-68-21-4.us-west-2.compute.amazonaws.com/

then after uploading site to Amazon I need to run web.cmd in site root

Sergey Sypalo
  • 1,223
  • 5
  • 16
  • 35