hashbytes
hashbytes

Reputation: 799

404 Error for static files, aspnet core AddSpaStaticFiles roothpath, SPA Template

I've created a react project using asp.net core react spa template. Everything seems to be fine, but when I deployed the application in IIS, it is deployed as an application under the default website. When I try to access the site, the index file is coming, but static files are giving 404.

One solution I found is setting PUBLIC_URL to application name in iis and building the application and then deploy. But, Is there any other alternative solution from asp.net core side? like setting rootPath

// In production, the React files will be served from this directory
        services.AddSpaStaticFiles(configuration =>
        {
            configuration.RootPath = "ClientApp/Build";
        });

Upvotes: 4

Views: 871

Answers (0)

Related Questions