Home > OS >  Getting 503 error when deploying ASP.NET Core API to IIS
Getting 503 error when deploying ASP.NET Core API to IIS

Time:05-26

I'm trying to deploy a ASP.NET Core web API to IIS in Windows Server. I've followed this tutorial first to install IIS and deploy the API and then this other tutorial to configure the CORS policy.

I'm trying to fetch data from a React webpage that is hosted in the same server, opening it in Edge in the server itself. React works fine and the whole thing is tested in my own PC, so I guess the problem must be some IIS configuration.

After configuring the CORS I stopped getting the CORS error in React, so I guess I did that right, but now I'm getting a 503 error "aplication shutting down". I tried (unsuccessfully) setting up a log file. This is my web.config.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified"/>
        </handlers>
        <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
        <cors enabled="true" failUnlistedOrigins="true">
            <add origin="http://localhost">
                <allowHeaders allowAllRequestedHeaders="true">
                </allowHeaders>
                <allowMethods>
                    <add method="GET" />
                    <add method="POST" />
                </allowMethods>
            </add>
        </cors>
        <defaultDocument>
            <files>
                <add value="MyExe.exe" />
            </files>
        </defaultDocument>
    </system.webServer>
</configuration>

The server is a Windows Server 2022 freshly installed.

CodePudding user response:

You can try open Windows Event Viewer, try to find the error about IIS, click to view the error details, maybe it will help you.

  • Related