Using IIS 10 and .NET Core 2.0
The web.config was generated from a new .NET Core MVC project.
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\MvcMovie.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
With it in this configuration I can't open the configuration editor in IIS and gives a 500.19 error:
Config Source:
-1:
0:
If I remove the <aspNetCore /> node, it will open in the configuration editor in IIS but will give a 500.21 error:
Handler "aspNetCore" has a bad module "AspNetCoreModule" in its module list
What would I do to get about fixing this?
It sounds like you haven't installed the IIS Hosting bundle.
Go here: https://www.microsoft.com/net/download/all
Click the version of ".NET Core Runtime" that you need, then download the "Hosting Bundle Installer" under "Windows".
Related
I have a blazor app that is running fine on localhost.
Here's the steps I have taken to put my project live.
Setup new Windows Server on AWS.
Enabled IIS.
Installed ASP.NET Core Runtime Hosting Bundle.
Installed the URL Rewrite module.
Setup a SSL cert and DNS settings to point to IP.
Configured bindings to port 443 and picked the cert added path wwwroot/projectname
published my project using web deploy.
However, when navigating to my url I'm seeing 404 resource not found.
Only thing that is different is that the server added a web config to get it to run in IIS which looks like this.
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\App.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 8b081fc5-0f9d-4426-b9cf-90f4d30b5527-->
Anyone point me in the right direction as to what I should be looking out for or steps I may have missed as this is the first time I've attempted publishing a Blazor-Server application.
On my IIS, I have "AspNetCoreModuleV2" not "AspNetCoreModule" like this:
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\App.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 8b081fc5-0f9d-4426-b9cf-90f4d30b5527-->
See: Hosting A Blazor Visual Studio Project Directly In IIS
I'm trying to host two applications in IIS in Windows Server 2019, in the same site. One of the applications is a website's front-end, in Angular, and the other one is the website's API, in ASP.NET MVC (.NET Core 2.2.8).
The front-end application's URL is site_url/portal and the API's is site_url/api.
Before using the API's other actions, one has to request a JSON web token from the site_url/api/identity URL, using Windows Authentication.
The front-end seems to be working fine, but trying to reach the site_url/api/identity API in the quality control environment yields "HTTP Error 500.0 - Internal Server Error".
I activated detailed logs in IIS and the error message in Event Viewer was "Could not load configuration. Exception message: Attribute 'processPath' is required."
The API's web.config file does have a process path:
<?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=".\PortalAPI.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" forwardWindowsAuthToken="true"/>
</system.webServer>
</location>
</configuration>
Aditionally, the IIS error page shows something which I find strange. The request URL is correct, but the physical path is application_path\identity. "Identity" is an MVC controller, not a file.
The .NET Core 2.2 Windows Hosting Bundle is installed and the .NET path environment variable is set.
The application pool identity is an applicational user, and .NET CLR version is set to "No Managed Code".
The site has both Anonymous Authentication (for the front-end login page) and Windows Authentication enabled.
The thing is, I have hosted the applications in the exact same way in both the development environment and a clean Azure virtual machine, and they work in both, which makes me think this has to do with some setting in either IIS or the quality control machine itself.
Does anyone have any idea what the problem and/or possible solutions might be?
A missing configuration caused this error for me until I added it: environment variable ASPNETCORE_ENVIRONMENT
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\PortalAPI.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" >
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
</aspNetCore>
</system.webServer>
You can put this in web.config, but it will get removed if you publish a new version of the web app from Visual Studio. To avoid that, put it in applicationHost.config instead (in the location corresponding to your site).
I have the following webconfig file produced by visual studio 2017 on a .net core application
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\SportsStore.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
<!--ProjectGuid: 5795049b-4d7e-4559-9010-f9134df11849-->
Although the publish succeed I get the following on the web page
Detailed Error Information:
Module
IIS Web Core
Notification
BeginRequest
Handler
Not yet determined
Error Code
0x8007000d
Config Error
Config File
\\?\C:\inetpub\wwwroot\sportstore\web.config
Requested URL
http://localhost:80/sportstore
Physical Path
C:\inetpub\wwwroot\sportstore
Logon Method
Not yet determined
Logon User
Not yet determined
Config Source:
-1:
0:
Because I have already work only on apache and the build in IIS express of visual studio I do not know where to start from. Internet has plethora of info and I tried many things but nothing.
Any suggestion?
I'm getting an HTTP 502.5 error when trying to run my ASP.NET core 2.0 web app from IIS.
I've installed the .NET Core Windows Server Hosting Bundle and checked all my IIS settings as per this document https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/index?tabs=aspnetcore2x
The web.config looks like this.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\OscarWeb.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
The Windows event log produces the following errors.
It is IIS v6.2 running on Windows Server 2012 R2. The web application was built using ASP.NET Core 2.0.
When I run dotnet from the commandline as follows there are no errors:
dotnet oscarweb.dll
The first thing you have to do in this scenario is to create the logs folder if it is missing and check the stdout logs generated.
It can be several different things but from personal experience the most common issue i had was IIS not having enough permissions to run it. In IIS you can configure the Identity used in Advanced Settings. If it is using ApplicationPoolIdentity then change it to LocalSystem and see if it works. The logs in the stdtout file however will give you the answer.
The solution to this problem (in my case at least) was to reboot the web server. After installing the .NET Core Windows Server Hosting Bundle you need to reboot the server for them to be registered correctly.
Thanks to Chris Pratt (first comment underneath my question) for suggesting the answer :)
Not sure if your webconfig is complete. I believe aspnetcore tag needs to have the ASPNETCORE_ENVIRONMENT environment variable set as well.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\OscarWeb.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" >
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="YourRuntimeEnv" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</configuration>
I've deployed ASP.NET Core 1.1.1 app in IIS-10 on Windows 10 following this tutorial. But when I try to open Modules in IIS, I get the following error [For clear view you can click on the image to zoom in]:
Note:
It's a development machine and already has installed as shown below:
The app pool for the app is as follows:
And the Web.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>
UPDATE: Issue may have been related to this post
It turns out that ASP.NET Core Module is installed separately from the SDK and I needed to install ASP.NET Core Module for the above issue to be resolved as explained in this post. Thanks to #natemcmaster for helping me resolve the issue.