.NET Core publishing to IIS problems - 403.14
Solution 1
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.
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"
]
}
Solution 2
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>
Beau D'Amore
SOFTWARE ENGINEER, WITH 20+ years of experience committed to supporting key thought leaders in the advancement of sustainable programs and enrichment of overall operations. AREAS OF EXPERTISE Requirements Gathering Translate Business Needs Critical Thinking Priority Organization Senior Executive Collaboration Implement Design Functionality Team or Solo Capable Cloud and Legacy systems eCommerce Competency Sitecore Certified User Experience Skilled in the following: Visual Studio, C#, MVC, NET Core, WebAPI, SQL, JavaScript, JQuery, Bootstrap, Ajax, GIT, NodeJS, NightwatchJS, HTML, Jira, Azure Dev Ops, Testing Automation, AWS: EC2, RDS, S3 PROFESSIONAL EXPERIENCE Senior Programming Analyst, Vitas, Miami, FL 5/2019-present Senior Technology Developer, The Primacy, West Palm Beach, FL 5/2018-01/2019 Senior Software Engineer, Verity IQ (start-up), Boca Raton, FL 2/2018-04/2018 Software Engineer, OPENCLOSE, West Palm Beach, FL 8/2017-02/2018 .Net Engineer 2, RADIAL (Formerly eBay Enterprises), Boynton Beach, FL 10/2015-04/2017 .Net Operations Engineer, WEALTH MANAGEMENT SYSTEMS INC., West Palm Beach, FL 08/2014-04/2015 Software Engineer, TRIAGENCY, Philadelphia, PA 06/2012-01/2015 Senior Software Engineer, eDERM Systems LLC., Boca Raton, FL 03/2013-08/2013 Web Programmer, WEBIMAX.COM, Mt. Laurel, NJ & South Florida 06/2011-06/2012 EDUCATION Data Processing Trainers Business School, Philadelphia, PA Client Server Programming OCCUPATIONAL CERTIFICATIONS Sitecore Certified 9.0
Updated on July 03, 2022Comments
-
Beau D'Amore almost 2 years
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.
-
Beau D'Amore over 7 yearsok, how do I find out if the service account / user credentials set on the application pool has access to run / access the app? It is using ApplicationPoolIdentity. There are 30+ other sites running fine on this server, fyi.
-
aholtry over 7 yearsIf you are using the 'Authorize' attribute in any of your controllers then you need to make sure that that user or group is listed in the identity of the application pool. You can set this in IIS under Application Pools -> Advanced Settings -> Identity
-
Beau D'Amore over 7 yearsI don't understand what you mean. 'The user or group'... do you mean the person logging in? It doesn't make sense because only one account can be the app pool identity... I guess I am not getting what you're saying... "is listed in the identity of the app pool'... you mean those users under some AD group??
-
aholtry over 7 yearsCorrect, if they belong to an AD group then I would use the service account associated with that group as the Identity for the application pool. An easier example would be a single user. Just use their credentials for the Authorize in the controller as well as the identity in the Application Pool.
-
Beau D'Amore over 7 yearsThe app pool identity can only be one of four things, LocalService, LocalSystem, NetworkService, ApplicationPoolIdentity.... I think we're not on the same page... thanks for your help though.
-
aholtry over 7 yearsThose are the built in accounts. Do you not have the option for Custom account? That is where you can specify your own account. I will post a picture of it in my answer above.
-
aholtry over 7 yearsEither way, I'm sorry I wasn't more helpful and I hope you get the answer you need soon.
-
aholtry over 7 yearsI just ran into the 403 error again myself and it turns out I was publishing to the wrong folder. So an empty folder will produce a 403 error. Just FYI
-
Beau D'Amore over 7 yearsI'm publishing to the right spot, just isn't working. I scrapped it. Started a fresh project with the latest core 1.0 refs, moved all the classes over, touched it up so it works with the newer libraries, fired it up fine... and STILL...CAN'T.... PUBLISH......
-
aholtry over 7 yearsIs your application pool running? And is your site running? They both need to be running.
-
Beau D'Amore over 7 yearsthis isn't publishing an 'approot' folder anymore either.. just blobing it all in one folder above wwwroot
-
Beau D'Amore over 7 yearsI'm an idiot... I moved the IIS root folder to teh parent directory above wwwroot and now I get 'oops 500 internal server error' which means it started but had an error... thanks
-
aholtry over 7 yearsThat's great news, sometimes we just need to talk it out. Nice work and I hope you keep having better luck.
-
Martin over 3 yearsThe web.config file is generated when you run
dotnet publish --configuration Release
, if you are missing that file you are most likely not running the dotnet publish command.