4

I was trying to create a simple (default) Web API using dotnet core 3.1 in Visual Studio 2019 using "ASP.NET Core Web Application".

Once I created the (default) application and I was able to run it on IIS Express by pressing F5 in Visual Studio.

Then I want to publish so I went to windows features and turned on IIS then configured it by installing "WebPlatformInstaller_x64_en-US.msi" and "dotnet-hosting-3.1.2-win.exe" (for dot net core).

Then I ran the following in command prompt:

net stop was /y
net start w3svc

I did the publish using "Default Web Site/Test" configuration pointing to host: http://localhost and Self Contain Package with DotNet Core 3.1.

Also created a Application pool with "No Managed Code"

Application Pool

When I went to http://localhost/Test I got the following error message:

Error Message

Here is my Web.Config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
  <handlers>
    <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
  </handlers>
  <aspNetCore processPath="dotnet" arguments=".\TestApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
    </system.webServer>
  </location>
</configuration>
<!--ProjectGuid: 63addee1-2c1f-4679-94f4-df9dc952d8f9-->

I'm not sure if this is relevant information, when I did Pass-through Authentication test in IIS I'm getting the following:

Pass-through Authentication Test Results

I tried so many different ways of publishing and they all at the end getting the above error message. How can we resolve this?

jps
  • 20,041
  • 15
  • 75
  • 79
Ranch Camal
  • 501
  • 1
  • 4
  • 12
  • 3
    Have you installed the ASP.NET Core Hosting Bundle, and restarted the W3SVC service to refresh the PATH variable? – ColinM Mar 23 '20 at 16:58
  • 1
    I have installed the latest and did the following by running CMD under admin mode: net stop was /y then net start w3svc – Ranch Camal Mar 23 '20 at 21:17
  • Run some basic diagnostics, https://docs.jexusmanager.com/tutorials/ancm-diagnostics.html – Lex Li Mar 23 '20 at 22:46
  • JexusManager is throwing the exact same issue when I try to open the web.config with it. – Ranch Camal Mar 24 '20 at 04:19
  • It turned out to be our server was not allowed to have IIS turned on. It was configured as a data server. I had to get special permission to run IIS, then everything seems to work fine. – Ranch Camal Jun 25 '20 at 21:50
  • reinstall asp.net core hosting bundle. – Ecd Aug 05 '20 at 20:39

4 Answers4

3
  1. ensure corresponding Application Pool configured with No Managed Code
  2. ensure you've installed .NET Core Hosting Bundle
Artem Vertiy
  • 1,002
  • 15
  • 31
0

IMO, I will say you take a look through this walkthrough:

https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.1

Try check if Windows Process Activation Service (WAS) is activated on your system (server).

Turn stdoutLogEnabled="true" to get more detailed error from the app in a log file. Or turn on Developer Error Page in your Startup.cs class.

Ismail Umar
  • 836
  • 1
  • 11
  • 10
  • I did turn it on but then I realized my error is saying that it's having issues with Web.config. So not sure if it can even read the stdoutLogEnabled="true" configuration. – Ranch Camal Mar 24 '20 at 04:10
  • Oops, U can try this as a follow up, I know its 2.** solution but it should work for this situation too I guess. https://bytutorial.com/blogs/asp-net-core/http-error-50019---internal-server-error-when-publishing-aspnet-core-web-api-to-iis-server https://stackoverflow.com/questions/40805402/http-error-500-19-when-publish-net-core-project-into-iis – Ismail Umar Mar 24 '20 at 07:55
0

At My case, I attach .NET Core 3.1 apps on IIS win server 2019

I have installed .net core 3.1 runtime, and Hosting bundle, but something goes wrong

saka_iis

when I check at local compter I am missing :

Microsoft.WindowsDesktop.App 3.1.23 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

After I install .net Core Desktop Runtime the error gone.

cmd

runtime

Maybe the runtime need another installer..

toha
  • 5,095
  • 4
  • 40
  • 52
0

It turned out to be our server was not allowed to have IIS turned on. It was configured as a data server. I had to get special permission to run IIS, then everything seems to work fine.

Ranch Camal
  • 501
  • 1
  • 4
  • 12