0

I'm having trouble with an ASP.NET Core 8 MVC app with vite vue. My app runs locally in which I mound in a cshtml div id= app all the vue components.

Locally the vite server runs and everything is fine. I also use vite.aspnetcore nuget package.

However when I publish my app to IIS, I get so many missed 404 js and css files (I can only see the main.js) but they do exist in my wwwroot folder.

The vite build is configured to build all the assets in wwwroot with a manifest.json which it does but again 404 in published web app.

What to do here, please?

1 Answer 1

0

In your case the issue isn't that the files don't exist.. it's that IIS Core isn't resolving them correctly after publish.

It's that Locally the Vite dev server handles it, but on IIS you need to be explicit sometimes... when these type of issue arise.

In my opinion, you should check the core file of your project (like program.cs). It should include app.UseStaticFiles() and sometimes IIS blocks .js, .css, .map, so you have to add proper MIME types in IIS if needed.

Check your vite.config.js file; verify the base: config of app whether it is server from the root domain or hosted under a virtual directory.

These are the possible solutions. If you explain your properly with some code snippets, I would update my answer accordingly.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.