Hosting self-contained deployment of .NET CORE - no dotnet.exe - asp.net

I have followed (as far as I can tell) all of the instructions located here for a self contained .NET core deployment:
https://learn.microsoft.com/en-us/aspnet/core/publishing/iis
According to the page, I only need to run this command to get the module installed in IIS
DotNetCore.1.0.3_1.1.0-WindowsHosting.exe OPT_INSTALL_LTS_REDIST=0 OPT_INSTALL_FTS_REDIST=0
My web.config looks like this:
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\mypackage.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
But, the dotnet.exe is no where to be found on my server. What am I missing?

You seem to have published your application as a portable application (i.e. one that is trying to using shared runtime) but did not install the runtime. You either need to install the runtime, or you need make changes to your application (project.json/*.csproj really) to make it standalone in which case when publishing it will contain the runtime with it.
From web.config perspective - when publishing a standalone application the processPath is {application}.exe instead of dotnet

Related

Issue with web.config in Web API

I'm working on my first real world .Net Core 3.1 Web API and I'm getting an error with the web.config file but don't know what's wrong.
I create the Web API locally and it tests out just fine. I published the project to a local folder and then copied it out to IIS on our STAGE server. When I open IIS and click on any of the icons for the project (in this case I clicked the Logging icon) and I get an error "There was an error while performing this operation" and the file name points to the web.config in my folder structure.
The web.config file is created automatically when I publish the project. Anyone see what the issue could be with the web.config that's causing the problem?
<?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=".\AvTechAPI.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 24142d05-13a1-4655-b2b8-8f8456003615-->
Windows IIS
Solution: Install the hosting bundle.
Reason: Although the SDK normally contains the runtime, however, it seems the SDK installer is not registering the runtime correctly on the server.
Workaround (not recommended):
Change AspNetCoreModuleV2 to AspNetCoreModule inside web.config.
Azure platform hosting
Install the .NET Core runtime extension by selecting Extensions and then installing .NET Core Runtime.

Why is my ASP.net mvc app no longer running under IIS?

UPDATE: I fixed this by changing to AspNetCoreModule and used out of process.
This mvc site has been running for a while but after the last deploy, it will no longer run. The event log shows this error:
Application <path to app> failed to start. Exception message:
Application DLL was not found at <path to app>\.\Proxy.dll. Confirm the application dll is present. Single-file deployments are not supported in IIS.
In the csproj file, I have this:
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup>
And, I publish to a local folder like so:
dotnet publish <path to source>/Proxy.csproj -c Release -o ./build -r win10-x64 --self-contained true
Finally, the web config is this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\Proxy.exe" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</configuration>
And, since this ran up until last update, I believe IIS (version 8.5- Win Server 2012 R2) is setup correctly. Under modules, I see AspNetCoreModuleV2. The Apppool is setup with Integrated pipeline and no managed code.
Can somebody help me with this? Thanks. Eric

Can't deploy MVC application to IIS - Is my web.config file to blame

I'm struggling to deploy any MVC application onto IIS in a windows 10 environment.
I always get an HTTP error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid. It goes on to suggest there is a problem reading the configuration file.
On a similar post on this site it was suggested that asp.net was not installed but I'm certain that I've done it. I've used the Aspnet_regiis.exe tool and followed the instruction on the link below.
http://www.jammer.biz/enable-asp-net-on-windows-10/
The webconfig file as it came out of visual studio 2017 when I published is as follows:
<?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=".\HelloWorld.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
<!--ProjectGuid: e88818e3-e6fd-4105-94cc-5be77ed93582-->
I've not edited it since none of the tutorials I've followed it tell me to.
I've made sure that full access rights on the folder are granted.
Here is the error message as seen from in IIS.
Why is IIS struggling to read my config file?
Thanks in advance.
Ian
I had this same issue when trying to publish a .NetCore2.0 mvc app. The solution can be found here: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/index?view=aspnetcore-2.1&tabs=aspnetcore2x
In my case, I did not have the .NET Core Hosting Bundle installed.

IIS (There was an error while performing this operation)

I receive There was as error while performing this operation error referring to web.config. I follow below configuration:
OS is Windows server 2012 R2 with IIS version 8.5.
URL Rewrite 2.1 module is installed on the machine.
IIS_IUSRS has full access to the directory.
Application Initialization module is installed
.Net CLR Version v4.0.30319 and managed pipeline mode is integrated.
IIS configuration is as below:
Web config is as below:
<?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=".\MES.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
<!--ProjectGuid: e8701310-485f-4f88-b7d0-1473d07238ac-->
browsing the page I receive below message:
However, when I remove
<aspNetCore processPath="dotnet" arguments=".\MES.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
from web.config I don't receive (There was as error while performing this operation) error but I get below error:
This error occurred for me when trying to double-click on the Logging module for any site with a bad Web.config.
"Bad" includes Web.configs that just have a module IIS doesn't understand - in my case, IIS 10 couldn't understand the <rewrite> tag, and exploded with this extremely confusing error.
You can verify this by just commenting out the contents of your Web.config. The error goes away - then just gradually reduce how much is being commented out until you find the culprit, and track down that solution.
Add <aspNetCore> back and also install ASP.NET Core module on this machine,
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/aspnet-core-module?tabs=aspnetcore2x
I also wrote a tool to better automate such detection,
https://www.jexusmanager.com/tutorials/oob-500.html
This error is typically caused by a reference inside the web.config which cannot be resolved by the dotNet runtime.
If you are using dotNet core, AND you installed the dotNet core hosting bundle BEFORE you configured your server to run IIS you may get this error.
To fix it in this case, you need to re-run the dotNet core hosting bundle installer AGAIN, in "repair mode"
As described in the box entitled "Important", here.
I had this problem with .NET Core 2.1.
I installed 2.1 SDK (v2.1.301) and as Microsoft says Hosting Bundle now installs with SDK, but in my case this did't work.
This problem disappeared only when I installed 2.1 Runtime (v2.1.1) for Hosting Bundle Installer.
Maybe you need to install URL Rewrite
I had same problem.

Custom handlers for ASP.NET 2.0 Website in Classic mode in IIS 8.5 throwing 500 error

I have ASP.NET 2.0 website running in Classic Mode.
Server 2001/IIS 8.5.
I get this error when calling custom handler (something.abc).
I have my handler(something.abc) added to <system.webServer><handlers> section
<add name="Something.abc" verb="GET,HEAD" path="something.abc" type="ABC.MyHttpHandler, ABC" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified"/>
It was working fine in local IIS Express.
On Server when I changed the Application Pool setting: Enable 32-bit Applications= True it started working.
Question: Why I had to turn 32-bit mode and is there any way I can make it work without enabling 32-bit?
I ran into this problem with an application running on a new Windows Server 2016 box with IIS 10.
It was working on the old Server 2012 box because that one had the 32-bit Oracle client installed, but the new server had the 64-bit Oracle client installed, and I was therefore unable to set Enable 32-bit Applications= True without causing other problems.
The worker process was also set up to use Classic pipeline instead of Integrated, another setting that I could not change in order to get this to work. ASP.NET was properly installed too. (i.e. this solution did not help me.)
I had:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="Something.abc" verb="*" path="something.abc" type="ABC.MyHttpHandler, ABC" resourceType="Unspecified" />
To solve this issue I added BOTH of these attributes (it did not work with only one or the other):
modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll"
i.e. final result was:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="Something.abc" verb="*" path="something.abc" type="ABC.MyHttpHandler, ABC" resourceType="Unspecified" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" />

Categories

Resources