Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asp.Net Core tag in web.config causes failure

I have a .NET Core application which works on one machine but not on another.

The problem is that the application fails to load, because the IIS does not recognize the following

<aspNetCore processPath="dotnet" arguments=".\MyApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />

The result is that when I click on the IIS authentication configuration, I get an error. If I remove the aspNetCore tag I can view the authentication settings, but then the application doesn't actually start.

Before you start giving advice about not using web.config for .NET Core, remember that it works on my other machine. Also, I need to use Windows Security and ASP.NET Impersonation.

Both machines are running Windows 10 Pro, and I have checked the following

  • IIS features installed: identical
  • WAS and W3SVC: both started and running under Local System
  • Application Pool: both have .Net 4.0 CLR, classic mode
  • Folder and file security: identical
  • Binary compare of the application and all dlls: identical

I don't normally work with IIS and .NET, so I'm quite puzzled that my application breaks on one of two seemingly identical installations. I have run out of things to check. Any help or pointers would be greatly appreciated.

Here is the complete web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
    <authentication mode="Windows" />
    <authorization>
      <deny users="?" />
    </authorization>
    <identity impersonate="true" />
  </system.web>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\MyApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
  </system.webServer>
</configuration>
<!--ProjectGuid: a447f5e7-6aee-4d26-bef4-c7111a88c409-->
like image 324
Klaus Groenbaek Avatar asked Oct 06 '17 10:10

Klaus Groenbaek


People also ask

Does .NET core still use web config?

Setup configurationASP.NET Core no longer uses the Global. asax and web. config files that previous versions of ASP.NET utilized.

Does ASP NET core need web config?

In order to set up the ASP.NET Core Module correctly, the web. config file must be present at the content root path (typically the app base path) of the deployed app.

What is Web config in .net core?

web. config file is an XML-based configuration file used in ASP. NET-based applications to manage various settings that are concerned with the configuration of our website. In this way, we can separate our application logic from configuration logic.

Does .NET core use IIS?

IIS and ASP.NET Core The most important thing to understand about hosting ASP.NET Core is that it runs as a standalone, out of process Console application. It's not hosted inside of IIS and it doesn't need IIS to run.


1 Answers

I was also facing the same issue and it was because the machine was missing the NET Core Windows Server Hosting bundle. If this is not installed then IIS cannot recognize the aspNetCore section in web.config

You can install the bundle from below location.

NET Core Windows Server Hosting bundle

like image 135
Kiran B Avatar answered Oct 17 '22 17:10

Kiran B