Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET Core publishing to IIS problems - 403.14

I am trying to publish a Core 1.0 app to a 2012R2 box that runs fine locally in IIS Express.

  • Installed DotNetCore.1.0.0-WindowsHosting.exe on server
  • Installed httpPlatformHandler_amd64.msi
  • Set app pool to have 'no managed code'
  • published from VS using 'Web Deploy'
  • Latest VS Core Tools as of this writing

All I get is:

HTTP Error 403.14 - Forbidden

The Web server is configured to not list the contents of this directory.

In this article from Microsoft it only mentions that a 403.14 Forbidden error is created by picking the wrong directory for the site... which is not the case.

VS does NOT pusblish the web.config, however. And there is no choice for 'copy to server always' or 'content' (in DDL), both choices are missing.

like image 801
Beau D'Amore Avatar asked Aug 30 '16 15:08

Beau D'Amore


2 Answers

Check if there is web.config in your application's folder. If there is no web.config in the folder IIS don't know it's an ASP.NET Core application, it thinks you are trying listing the file in that folder. So if you set IsTransformWebConfigDisabled property in the project configuration to true, which caused Web.config file isn't generated in the publish folder when build it. So Change the IsTransformWebConfigDisabled property to false in YourProjectName.csproj file like this:-

<IsTransformWebConfigDisabled>false</IsTransformWebConfigDisabled>
like image 150
Assefa Tedla Avatar answered Nov 09 '22 02:11

Assefa Tedla


Make sure that the service account / user credentials set on the application pool has access to run / access the app. That was my issue when deploying to IIS a few times.

enter image description here

As for including the web.config, make sure to include the following code in your project.json file. Just specify what you want to include in the publish.

"publishOptions": {
  "include": [
    "wwwroot",
    "Views",
    "appsettings.json",
    "web.config"
  ]
}
like image 6
aholtry Avatar answered Nov 09 '22 03:11

aholtry