Umbraco模板保存失败:404未找到umbraco/RestServices/SaveFile/SaveTemplate
Alright, let's break down what's going on with your Umbraco instance and get these issues sorted out. You've got two related problems: a silent template save failure with a 404 in the console, plus a scheduled publishing error in your logs. Let's tackle them one by one.
1. Template Save 404 Error (umbraco/RestServices/SaveFile/SaveTemplate)
That 404 means Umbraco's REST endpoint for saving templates isn't being found or can't execute properly. Try these fixes:
- Recycle your application pool: Sometimes Umbraco's routing doesn't register correctly on startup. Recycling the pool forces the app to reload and re-register all REST routes—this is a quick first step that often fixes missing endpoint issues.
- Check file system permissions: Make sure the identity running your IIS application pool (usually
IIS AppPool\[YourPoolName]) has read/write access to:- The
Viewsfolder (where templates are stored) - The
App_Datafolder - The root
umbracofolder
Without proper write permissions, the save operation fails silently, and the server might return a misleading 404 instead of a permission error.
- The
- Verify URL rewrite rules: If you're using IIS URL Rewrite, double-check that none of your rules are blocking requests to
umbraco/RestServices/*. Temporarily disable rewrite rules to test if that's the culprit. - Confirm Umbraco version compatibility: If you recently upgraded Umbraco, it's possible the REST endpoint path changed for your version. Cross-reference your Umbraco version with official docs to ensure the template save endpoint path matches what your instance expects.
2. Scheduled Publishing WebException ("Connection closed unexpectedly")
This error happens when Umbraco's scheduled task can't make an internal request to your site. Common fixes include:
- Set a base URL for scheduled tasks: In your
Web.config, add this to the<appSettings>section to force the scheduler to use a reliable local URL:
This fixes issues where the scheduler can't resolve your site's domain correctly (e.g., if you only have a domain binding, no localhost binding).<add key="Umbraco.Core.Scheduling.ScheduledTasksBaseUrl" value="http://localhost:[YourSitePort]" /> - Fix SSL/certificate issues: If your site uses HTTPS with a self-signed or untrusted certificate, the
WebClientused by the scheduler will reject the connection. For testing, you can temporarily allow HTTP access; for production, use a trusted SSL certificate and ensure the server trusts it. - Adjust application pool settings: If your app pool has an idle timeout set, it might shut down the site before the scheduled task runs. Set the idle timeout to
0(no automatic shutdown) or configure a warm-up task to keep the site alive. - Check firewall/security software: Local firewalls or antivirus tools might block the scheduler's internal requests. Review their logs to see if they're blocking traffic to your site's URL, and add an exception if needed.
Possible Connection Between the Two Issues
Don't be surprised if fixing one problem resolves the other—both issues often stem from the same root cause, like insufficient application pool permissions or a misconfigured site that prevents internal requests. Start with the permission and app pool recycle steps, then test both template saving and scheduled publishing again.
内容的提问来源于stack exchange,提问作者Gokul Sridhar

