How to deploy a Rust web service on IIS? - iis

I'm trying to deploy a web service written in Rust to the Mochahost Windows server. I found Suave in IIS - Hello world but HttpPlatformHandler is replaced by ASP.NET Core Module.
I tried to replace '..\MySite.exe' in the following line but that did not work:
<aspNetCore processPath="..\MySite.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile="..\logs\stdout" />

Related

How do I configure a .net core API to work in IIS?

I've got a .net core API created in Visual Studio 2017 that's working fine. When I go to deploy it I get error message HTTP Error 500.19 with error code 0x8007000d. I've found multiple solutions online such as making sure windows features are installed, removing the .net CLR version, changing the application pool identity, changes to web.config and applicationHost.config, but nothing has worked. Is there a way to definitively find what the problem is or am I stuck doing trial and error with the myriad of possible solutions? Any specific solutions you know of?
Here are screenshots of the IIS settings and my Windows features:
Here's my 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="dotnet"
arguments=".\DishbooksAPI.dll"
stdoutLogEnabled="false"
stdoutLogFile=".\logs\stdout"
forwardWindowsAuthToken="false" />
</system.webServer>
</configuration>
Here's the IIS error:
Some stackoverflow pages I've tried (this is not an exhaustive list):
HTTP Error 500.19 when publish .net core project into iis
HTTP Error 500.19 with Error Code 0x8007000d visual studio 2017 while deploying .net core application
ASP.NET: HTTP Error 500.19 – Internal Server Error 0x8007000d
HTTP Error 500.19 - Internal Server Error web config .net core web api
asp.net core web api published in IIS after moved to different IIS server pc gives error 500.19
First of all, you need to install ASP.NET Core Module in web server.
Here is the download link.
Then install either SDK or Runtime in web server.
Trouble Shooting
If it still doesn't work, open a command prompt. Navigate to the web application folder and type dotnet YOUR_APP.dll. You should see something like this -
C:\APIs> dotnet YOUR_APP.dll
Hosting environment: Production
Content root path: C:\APIs
Now listening on: http://localhost:5000
Application started: Press Ctrl+C to shut down.
It means your application can run in the web server without IIS. Then you need to trouble shoot in IIS or some other things.
You would need the hosting bundle to be installed on IIS
https://dotnet.microsoft.com/download/dotnet-core
Steps :
click the preferred version
Search for 'Hosting Bundle' word (should be on the right side)
Install the same
re-start IIS. And validate your site and see the magic
Why Hosting bundle is needed? Check following article
https://dotnetcoretutorials.com/2019/12/23/hosting-an-asp-net-core-web-application-in-iis/
How to check if hosting is installed?
How to determine if asp.net core has been installed on a windows server

Core 2.0 Publish IIS HTTP Error 500.19 - Internal Server Error

I have read a lot of post with the same error I have. The problem I have is that I have it running on the same machine I developed the solution.
I have Windows 8.1 and IIS 7.5. Express I am running several MVC Framework XXX solutions on me IIS and I do not have problems. The problems appears when I publish a solution Core 2.0...
I have created a basic Web Core 2.0 MVC solution. Just the same project it is created by Default. (Created an Core 2.0 MVC and Publish it).
I have Visual Studio 2017, so I have installed SDK installed.
I have created a site in IIS (inetpub/wwwroot) for it, drop in the published code, and configure the App Pool to run "No Managed Code". I set port to 5010.
When I run the Project from cmd: dotnet core20.dll it says it is running listening on port 5000, instead on port 5010.
So, i set port 5000, but when i run it from cmd it shows an error.
Microsft.AspNetCore.Server.Kestrel[0] Unable to bind to localhost:5000 on the IPv4 loopback interface: Error 4092 EACCES permission denied. Unabled to start Kestrel.
Why it runs on port 5000 if I set on port 5010?
When I run it from Browser i have this error
My web.Config is the basic web.config created ruting the publishing..
<?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=".\core20.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
<!--ProjectGuid: 21dc60b6-a958-447d-8ed3-25a6195a06ea-->
On Windows Features turn on or off--> IIS Services--> Application Development Features, all options are selected
The error I have
I have the same problem with Core 2.0 Angular Application... So I miss to install something.
I have not installed the .NET Core Windows Server Hosting bundle. I do not know it is necessary.
I do not know if i have to install Kestrel, or how to install it.
I asume all this has to be installed when I installed Visual Studio 2017.
Any ideas what I am missing?
thanks
I have not installed the .NET Core Windows Server Hosting bundle. I do not know it is necessary.
There's your problem. Install the hosting bundle. Without it, IIS has no idea how to handle an ASP.NET Core app. In particular, your error here is because the <aspNetCore> tag doesn't exist for usage by Web.config, without that bundle either. So, while the error is a bit obtuse, it is technically telling you what the issue is.
Additionally, after installing the bundle, you must either restart your server or completely stop and restart the IIS service (not iisreset):
> net stop was /y
> net start w3svc
It's better to restart the server entirely, if you can, just to make sure everything is fresh, but starting and stopping web services should be enough to load in the ASP.NET Core module.
All of this is covered in the documentation.

ASP.NET Core 1.1 works under Default website in IIS but not under a custom website

Machine: Windows Server 2012 R2 with IIS 8.5 on a company network.
Following this tutorial
Success: In IIS, deployed a published folder of an ASP.NET MVC Core 1.1.1 app to an Application Folder under Default Website. From a desktop on the same network, browsed to the URL http://IP Address/MyPublishedFolder. The app successfully displayed its home page.
Failure: Created a custom website on the same IIS with one of the DNS Names at the company: Ourapps.ac.CompanyName.com with host folder named as Ourapps.ac.CompanyName.com. Copied the exact same published folder MyPublishedFolder to Ourapps.ac.CompanyName.com. From a desktop on the same network, browsed to the URL: http://Ourapps.ac.CompanyName.com/MyPublishedFolder. Got the browser error: HTTP Error 502.5 - Process Failure. In the Event Viewer, the Application Log shows the following error:
Application 'MACHINE/WEBROOT/APPHOST/Ourapps.ac.CompanyName.com' with physical root 'C:\Ourapps.ac.CompanyName.com\' failed to start process with commandline '"" ', ErrorCode = '0x80070057 : 0.
Question: Why the same app is working under Default Websitebut not under custom website - and how can we resolve the issue?
Note:
http://Ourapps.ac.CompanyName.com/MyPublishedFolder works fine if I replaced all content of MyPublishedFolder with a simple Index.html file created on a notepad. So the issue does seem to be related to ASP.NET Core's published folder deployed to a custom website
Both the apps on the above examples are running with a No Managed Code Application Pool.
UPDATE:
Please note the same ASP.NET Core website works fine under Default Website on the same server. That means the sever has all the necessary configurations (hosting bundle DotNetCore.1.0.5_1.1.2-WindowsHosting installed etc.) for an ASP.NET Core 1.1.1 to run on IIS.
Web.config
<?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=".\MyCoreWebApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
</system.webServer>
</configuration>
<!--ProjectGuid: 9e4933bc-a6d0-4aa8-b34c-c6db94ed0742-->

MVC 6 Hosted on IIS HTTP Error 500.19

Am getting HTTP Error 500.19 when accessing MVC 6 app in IIS on Windows 10.
In IIS I have set the App pool to 'No Managed Code'
The app is hosted in the root of a new Web Site.
I published the app using Visual Studio 2015 with the following settings.
Configuration : Debug
Target DNX Version: dnx-clr-win-x64.1.0.0-rc1-update1
The web.config is the boilerplate provided by Visual Studio
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
</handlers>
<httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false" startupTimeLimit="3600"/>
</system.webServer>
</configuration>
Any ideas what is going wrong?
Thanks
Mike
For RC2 and above, HttpPlatformHandler has been replaced by ASP.NET Core Module
Install the new module from here.
The announcement can be found here.
Figured it out, I needed to install the httpplatformhandler
http://www.iis.net/downloads/microsoft/httpplatformhandler
You have to install the "Hosting Bundle Installer". Without this, IIS doesn't understand routing and cannot host your application.
Go to microsoft site "https://www.microsoft.com/net/download/dotnet-core/runtime-2.1.0-rc1" and install "Hosting Bundle Installer":
Before installing this you have to install the right version of runtime:
https://www.microsoft.com/net/download/dotnet-core/runtime-2.1.0-rc1
Than install the right version of "Hosting Bundle Installer".
"Hosting Bundle Installer" is:
.NET Core Windows Server Hosting bundle installs the .NET Core Runtime, .NET Core Library,
and the ASP.NET Core Module. The module creates a reverse proxy between IIS and the Kestrel server on Windows platforms.

HTTP Error 403.14 - Forbidden asp.net 5 & MVC 6 iis10

I know this question has been asked and answered a few time but those questions are slightly different and the answers to those questions do not resolve my issue.
I have a asp.net 5 & MVC 6 application that works fine in IIS Express and self hosted in WEB. However when I publish to a folder and point IIS at the wwwroot folder I get the HTTP Error 403.14 - Forbidden error.
I have tried IISReset and I do have a default root.
Requirements
Windows 7 or better
Windows Server 2008 R2 or better
Have IIS installed
Procedure
First, make sure you have the HTTP Platform Handler installed in your IIS (x86 / x64).
Publish your application to the file system and take the content of the \artifacts\bin\MyWebApp\Release\Publish folder and copy it into your IIS Server.
When configuring your application, target the wwwroot folder that you copied over.
Now you'll need to unlock the system.webServer/handlers section which can be found in IIS Manager on the server node under Configuration Editor. Search for the right section and unlock it from the right action pane.
Make sure that the App Pool is set to No Managed Code. DNX is being run as an external process. IIS doesn't need to know about what it's currently running.
Finally, create a web.config with the following content:
<configuration>
<system.webServer>
<handlers>
<add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="..\approot\web.cmd" arguments="" stdoutLogEnabled="false" stdoutLogFile="..\logs\stdout.log" startupTimeLimit="3600"></httpPlatform>
</system.webServer>
</configuration>
It should be running at that point.
Source

Resources