ASP.NET Core 3.1 app straight out of the box runs in VS 2019 but not from iis. Getting HTTP Error 500.19 0x8007000d

1

I'm publishing an ASP.NET Core 3.1 web application with no content (i.e. straight out of the box) and getting the title error when trying to run the website.

I'm using the Folder Profile option in 'Publish'.

What is unusual is the contents of the published folder - the folders are:

cs  de  es; 

etc including

wwwroot;  zh-hans;  zh-hant;  appsettings.development.json 
appsettings.json 
Microsoft.AspNetCore.Mvc.Razor.Extensions.dll 
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.dll 
Microsoft.AspNetCore.Razor.Language.dll 
Microsoft.CodeAnalysis.CSharp.dll 
Microsoft.CodeAnalysis.dll 
Microsoft.CodeAnalysis.Razor.dll 
Microsoft.Extensions.DependencyModel.dll 
System.Text.Json.dll 
web.config 
WebTest.deps.json 
WebTest.dll 
WebTest.exe 
WebTest.pdb 
WebTest.runtimeconfig.json 
WebTest.Views.dll 
WebTest.Views.pdb

The web.config file is:

<?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=".\WebTest.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
    </system.webServer>
  </location>
</configuration>
!--ProjectGuid: FAD94D81-0B07-4B20-8215-9AD183B65D61--

I've tried an assortment of option changes with no effect.

Any help would be gratefully appreciated, thanks

Further to your comments: Running from IIS Manager the error is: * HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid. Error Code 0x8007000d Config Error
* Publshed again: set target = win-x64 instead of Portable Self-contained

* I ran dotnet webtest.dll as suggested and got no obvious errors. Ran again from IIS manager and got the same error!

C:\Temp\WebDemos\AnnaMayTestFolder>dotnet webtest.dll
dbug: Microsoft.Extensions.Hosting.Internal.Host[1]
      Hosting starting
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
      User profile is available. Using 'C:\Users\bill\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
dbug: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[37]
      Reading data from file 'C:\Users\bill\AppData\Local\ASP.NET\DataProtection-Keys\key-5f27c4fc-fa29-4712-a66e-a5c00fd8c31c.xml'.
dbug: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[37]
      Reading data from file 'C:\Users\bill\AppData\Local\ASP.NET\DataProtection-Keys\key-a07760bd-83a7-4ff1-963d-370c2bbee546.xml'.
dbug: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[18]
      Found key {5f27c4fc-fa29-4712-a66e-a5c00fd8c31c}.
dbug: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[18]
      Found key {a07760bd-83a7-4ff1-963d-370c2bbee546}.
dbug: Microsoft.AspNetCore.DataProtection.KeyManagement.DefaultKeyResolver[13]
      Considering key {a07760bd-83a7-4ff1-963d-370c2bbee546} with expiration date 2020-09-05 18:58:12Z as default key.
dbug: Microsoft.AspNetCore.DataProtection.TypeForwardingActivator[0]
      Forwarded activator type request from Microsoft.AspNetCore.DataProtection.XmlEncryption.DpapiXmlDecryptor, Microsoft.AspNetCore.DataProtection, Version=3.1.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 to Microsoft.AspNetCore.DataProtection.XmlEncryption.DpapiXmlDecryptor, Microsoft.AspNetCore.DataProtection, Culture=neutral, PublicKeyToken=adb9793829ddae60
dbug: Microsoft.AspNetCore.DataProtection.XmlEncryption.DpapiXmlDecryptor[51]
      Decrypting secret element using Windows DPAPI.
dbug: Microsoft.AspNetCore.DataProtection.TypeForwardingActivator[0]
      Forwarded activator type request from Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.AuthenticatedEncryptorDescriptorDeserializer, Microsoft.AspNetCore.DataProtection, Version=3.1.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 to Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.AuthenticatedEncryptorDescriptorDeserializer, Microsoft.AspNetCore.DataProtection, Culture=neutral, PublicKeyToken=adb9793829ddae60
dbug: Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngCbcAuthenticatedEncryptorFactory[4]
      Opening CNG algorithm 'AES' from provider '(null)' with chaining mode CBC.
dbug: Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngCbcAuthenticatedEncryptorFactory[3]
      Opening CNG algorithm 'SHA256' from provider '(null)' with HMAC.
dbug: Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider[2]
      Using key {a07760bd-83a7-4ff1-963d-370c2bbee546} as the default key.
dbug: Microsoft.AspNetCore.DataProtection.Internal.DataProtectionHostedService[0]
      Key ring with default key {a07760bd-83a7-4ff1-963d-370c2bbee546} was loaded during application startup.
dbug: Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer[2]
      Failed to locate the development https certificate at '(null)'.
dbug: Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer[0]
      Using development certificate: CN=localhost (Thumbprint: 5D0B4342CC4EAD5ED23E1752F64EC374F9EE941C)
dbug: Microsoft.AspNetCore.Server.Kestrel[0]
      No listening endpoints were configured. Binding to http://localhost:5000 and https://localhost:5001 by default.
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: https://localhost:5001
dbug: Microsoft.AspNetCore.Hosting.Diagnostics[0]
      Loaded hosting startup assembly WebTest
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.

info: Microsoft.Hosting.Lifetime[0] Hosting environment: Production info: Microsoft.Hosting.Lifetime[0] Content root path: C:\Temp\WebDemos\AnnaMayTestFolder dbug: Microsoft.Extensions.Hosting.Internal.Host[2] Hosting started

* Could anyone confirm that the Publish Target output folder structure shown above is typical? It looks completely wrong to me! What would a typical published folder look like? This is my first attempt at building a web site.

I am now completely stumped having researched all that I can on this problem. If anyone can help further that would be good.

c#
asp.net-core
asked on Stack Overflow Jun 28, 2020 by Pat McGowan • edited Jun 30, 2020 by Pat McGowan

2 Answers

0

As was stated by Max, run dotnet WebTest.dll from its directory using a command prompt or powershell on the server. This should give you a more detailed explanation of the issue. If you are not publishing the application as Self-Contained then you will need to install the server hosting bundle (https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.1#install-the-net-core-hosting-bundle), if you've not already done so.

answered on Stack Overflow Jun 28, 2020 by Julian
0

Publish Target output folder structure shown above is typical.

When you deploy your app on IIS (local or remote) make sure your target folder has following security permission:

enter image description here

answered on Stack Overflow Jun 30, 2020 by Mohammad Barbast

User contributions licensed under CC BY-SA 3.0