How to create IIS-website from powershell in order to host .net core 2.0 app, error 0x8007000d


Expected Result:

IIS hosts my app correctly, and when I navigate to the url of my app (e.g: blabla/swagger) I see the swagger UI describing my app


When I try to navigate to my app it says:

HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.


I built an app in .net core 2.0 and I am able to make it run through visual studio, being hosted by Kestrel. However I need to deploy this app to different servers and since Kestrel doesn't support host names, I need to make it being hosted in IIS . When I make it run through Kestrel I am able to access it correctly and by navigating to the url/swagger address, I am able to see the correct swagger page that describes the app. My app is being published from visual studio. Which means in its published folder there are all the dlls that the app needs. It's being published as a framework dependent app, not a standalone one, but this shouldn't matter.

How to replicate the problem

Since I need this one day to be hosted in IIS inside a Docker container, I am trying to make it being hosted in IIS with powershell scripts. What I did to make it being hosted in IIS is:

New-Website -Name 'myTestApp' -force -Port 8080 -PhysicalPath
'C:\Users\myUser\Desktop\Docker\PublishOutput' -ApplicationPool 'MyAppPoolTest'

Where C:\Users\myUser\Desktop\Docker\PublishOutput is the path to the published folder where Visual Studio publishes the app. Thanks in advance!

This is the web.config generated by Visual studio when publishing:

<?xml version="1.0" encoding="utf-8"?>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    <aspNetCore processPath="dotnet" arguments=".\Friss.CaseApi.Web.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
<!--ProjectGuid: 313d542d-7676-4440-ae1b-22c6071f4309-->

And the error page is:

enter image description here

Am I setting the web.config in the wrong way?

asked on Stack Overflow Jun 29, 2018 by Tarta

2 Answers


Check the documentation here

  1. You need to publish your website and then point IIS website to the published folder
  2. Application pool must be set to No Managed code
  3. Application Pool identity user IIS AppPool\{AppPoolName} must have read permissions on the published website folder
answered on Stack Overflow Jun 29, 2018 by Mohsin Mehmood

Found the solution,

the system requires the dotnet core windows hosting bundle. The bundle installs the .NET Core Runtime, .NET Core Library, and the ASP.NET Core Module.


Direct download to the bundle for .netcore 2.0.6 that solved my problem:

answered on Stack Overflow Jun 29, 2018 by Tarta

User contributions licensed under CC BY-SA 3.0