You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

IIS部署JQuery Web应用遇404错误及页面显示异常求助

Troubleshooting Your IIS Deployment Issue for jQuery Web App

Hey there! Let’s work through this deployment problem together—it’s super common when moving from a local dev server like http-server to IIS, and the root cause almost always boils down to static asset serving or configuration mismatches. Here’s a step-by-step breakdown to fix those 404 JS errors, broken menus, and partial text display:

1. Double-Check Site Path & Resource References

  • First, confirm your IIS site’s physical path points directly to your app’s folder under wwwroot. For example, if you copied code to C:\inetpub\wwwroot\MyWebApplication, the site’s physical path must be set to that exact folder—not just C:\inetpub\wwwroot.
  • Open your browser’s DevTools (F12) → Network tab, look at the failed JS requests. Compare the requested URL (e.g., http://localhost/js/app.js) to where the file actually lives on the server (e.g., C:\inetpub\wwwroot\MyWebApplication\js\app.js). If there’s a mismatch (like missing /MyWebApplication in the request), your HTML’s resource paths are off. Fix them to use relative paths (e.g., ./js/app.js) instead of absolute paths if needed.

2. Enable Static Content in IIS

IIS doesn’t serve static files like JS/CSS by default—this is a top culprit for 404s:

  • Open Server Manager → Add Roles and Features.
  • Navigate to Web Server (IIS) → Web Server → Common HTTP Features.
  • Check the box for Static Content, then complete the installation.
  • Restart your IIS site (right-click the site → Manage Website → Restart).

3. Adjust Application Pool Settings

Since this is a pure front-end jQuery app, you don’t need .NET runtime support:

  • Go to IIS Manager → Application Pools.
  • Find the pool linked to your MyWebApplication site, right-click it → Advanced Settings.
  • Under General, set .NET CLR Version to No Managed Code.
  • Save the changes and restart the application pool.

4. Verify Folder Permissions

IIS needs read access to your app’s files:

  • Right-click your MyWebApplication folder → Properties → Security tab.
  • Click Edit → Add, then type IIS_IUSRS in the object name field and click Check Names to confirm.
  • Give this user Read and List Folder Contents permissions, then apply the changes.

5. Test Direct Static Asset Access

To isolate the issue, try accessing a JS file directly via URL (e.g., http://localhost/MyWebApplication/js/jquery.min.js):

  • If you get a 404: Double-check the file exists in the correct path and your site’s physical path is set right.
  • If you get a 403: Permissions are the problem—go back to step 4 to fix them.

Once you work through these steps, your app should load correctly, menus should function, and those JS 404 errors should disappear. Let me know if you hit any snags along the way!

内容的提问来源于stack exchange,提问作者Pizzor2000

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 07:31:56