Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure ASP.NET Core 1.0 to use Local IIS instead of IIS Express?

How can I setup a .Net Core 1.0 project to use Local IIS instead of IIS Express when debugging?

I have tried modifying launchSettings.json file in various ways. For example, replacing all occurrences of IIS Express with Local IIS and updating the applicationUrl and launchUrl to use my custom localhost http://sample.local (I have updated the host file and configured IIS manager already) but not happy.

Default settings of Properties/launchSettings.json file:

{   "iisSettings": {     "windowsAuthentication": false,     "anonymousAuthentication": true,     "iisExpress": {       "applicationUrl": "http://localhost:38601/",       "sslPort": 0     }   },   "profiles": {     "IIS Express": {       "commandName": "IISExpress",       "launchBrowser": true,       "environmentVariables": {         "ASPNETCORE_ENVIRONMENT": "Development"       }     },     "SampleApp": {       "commandName": "Project",       "launchBrowser": true,       "launchUrl": "http://localhost:5000",       "environmentVariables": {         "ASPNETCORE_ENVIRONMENT": "Development"       }     }   } } 
like image 672
Oluwafemi Avatar asked Jul 27 '16 17:07

Oluwafemi


People also ask

What is the difference between local IIS and IIS Express?

An important difference is the way worker processes are managed. In IIS, the Windows Process Activation Service (WAS) silently activates and deactivates Web applications and the user has no direct control. In IIS Express, there is no WAS and the user has full control of application activation and deactivation.

How do I disable IIS Express in Visual Studio?

Closing IIS Express By default Visual Studio places the IISExpress icon in your system tray at the lower right hand side of your screen, by the clock. You can right click it and choose exit. If you don't see the icon, try clicking the small arrow to view the full list of icons in the system tray.

How to deploy ASP NET Core to IIs?

Steps to Deploy ASP.NET Core to IIS Step 1: Publish to a File Folder. Step 2: Copy Files to Preferred IIS Location. Now you need to copy your publish output to where you want the files to... Step 3: Create Application in IIS. First, create a new IIS Application Pool. You will want to create one ...

How do I install IIs on ASP NET server?

To install an IIS web server and configure it for ASP.NET web applications, follow the steps listed. Step 1: Install IIS and ASP.NET Modules. Step 2: Configure ASP.NET Settings. Step 3: Configure Data Source Settings.

Does DotNet core DLL work with IIS Express?

It works fine in IIS Express! (BTW I tried combination of '/api' './api' 'api' without any luck) Thanks much! Just wondering did not you notice following - while running from behind IIS dotnet core app loose ability to read machine level environment variables, but if run it as dotnet app.dll all works as expected

How do I build a website on IIS 8?

The first step in building an ASP.NET website on IIS 8 is to install IIS along with the ASP.NET modules. Then add your ASP.NET application files to IIS.


1 Answers

You currently cannot directly use IIS to host an ASP.NET Core application while developing, as the development folder does not provide all of the necessary files IIS needs to host. This makes running an ASP.NET Core in a development environment a bit of a pain.

As pointed out in this article by Rick Strahl, there aren't many reasons to try and do this. IIS does very little when running ASP.NET Core apps - in fact your application no longer runs directly in the IIS process, instead it runs in a completely separate console application hosting the Kestrel web server. Therefore you really are running in essentially the same environment when you self host your console application.

If you do need to publish your app, you can do so to a local folder, using either the dotnet command line, or using the Visual Studio tools.

For example, if you want to publish to the C:\output folder, you can use the following command:

dotnet publish   --framework netcoreapp1.0    --output "c:\temp\AlbumViewerWeb"    --configuration Release 

You can then point your IIS Site at the output folder. Ensure that you set the application pool CLR version to No Managed Code and that the AspNetCoreModule is available.

For more details, see https://docs.asp.net/en/latest/publishing/iis.html

like image 190
Sock Avatar answered Sep 19 '22 12:09

Sock