Search code examples
iisrustiis-8

How to create a web.config for a non ASP.net executable in IIS?


I need to host an API I wrote in Rust with IIS, I have never used IIS. Everyone else I have spoke to has been using .NET and found it to be pretty much just plug and play.

Any time I create a web.config file based on https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/web-config?view=aspnetcore-7.0 I get a 500.19 internal server error. If I do not create a web.config I presume it isn't even trying to do anything and I get 403.14 Forbidden.

<?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=".\MyApp.exe"
                  stdoutLogEnabled="false"
                  stdoutLogFile=".\logs\stdout"
                  hostingModel="inprocess" />
    </system.webServer>
  </location>
</configuration>

The above was basically what I used that gave me the 500.19 error, and within IIS it complains that it cannot read the configuration file at all which is rather annoying considering I got this config off of microsoft's documentation.


Solution

  • HttpPlatformHandler was the answer, thank you Microsoft for making that so hard to find. You do not have to use reverse proxy, FastCGI, switch to .NET or anything like that.