Umbraco lazyload.js:260: error on loading extended backoffice js files - umbraco

i try to extend umbraco back office with a new section and the folder structure was like the attachment
App_Plugins/BackofficeApplication/backoffice/BackofficeTree/js/edit.controller.js
and then i decided to change the name of the folder and made different names and added the section again to the user privileges and i am sure i changed the name in the [Application] annotation and in [PluginController] and [Tree] annotation but lazy load try to load the javascript files from the old path and i tried also to change client dependency version but the problem still the same.
error screenshot

Check that your application is in debug mode - Umbraco caches static files (such as your JS file) using a client dependency handler. Cached files are stored in \App_Data\TEMP\ClientDependency (which can be deleted if you need your site to run out of debug mode).
If your site is in debug mode, this cache will not be used.
To turn debug mode on, search for debug in your web.config. You should find a section like this:
<compilation defaultLanguage="c#" debug="false" batch="false" targetFramework="4.5">
Set debug to true.

Most packages come with a package.manifest file which includes paths to all of the files which your package uses. Check that you have updated these paths with your new folder and file names.
The package.manifest should be in the route of your package folder in App_Plugins.

Related

Loading an MVC JS bundle externally

I have a small JS library in my MVC 5 project that I want to be available for external users to load into their apps. At the moment I'm bundling it like so:
bundles.Add(new ScriptBundle("~/clientApi")
.IncludeDirectory("~/Api/clientapps/", "*.js"));
I can then access the bundled library via browser at the path /clientApi.
However, it's always minified, even though I've set my web.config debug=true, and other bundles in my own app are included as non-minified.
How can I make the file/s in the bundle available as a non-minified bundle file?
If you access /clientApi directly then yes it will be the bundled/minified version.
The debug=true option effects your script reference in your own .cshtml file. When debug=true, references to the individual script files are rendered to the client (so the client doesn't use /clientApi at all).
When debug=false, then a reference to /clientApi (with the version query string) is rendered to the client instead, so they get the bundled/minified version... If you give that link to these external users, then that is what is going to get rendered.
That path doesn't care if it is debug or not. It's not like /clientApi is going to bundle but not minify the files depending on your compilation settings... it's just either your app is going to render the bundled/minified path or the individual script paths.
If you want to do debugging/testing in external apps, then they will just have to use the individual script paths.
Even if you do give these external apps the /clientApi reference once testing is done and they are ready to use the bundled/minified version, it doesn't explain how you are going to handle versioning. If you update a script, how will they know to stop caching?
Actually you can serve the bundle unminified if you disable the transforms of the Bundles
protected void Application_Start() {
BundleTable.EnableOptimizations = true; // Force bundling to occur
// If the compilation node in web.config indicates debugging mode is enabled
// then clear all transforms. I.e. disable Js and CSS minification.
if (HttpContext.Current.IsDebuggingEnabled) {
BundleTable.Bundles.ToList().ForEach(b => b.Transforms.Clear());
}
}

MVC Sitecore project - how to add key value settings on web.config

Quiet new to Sitecore hence this basic question to start with...
I've got a MVC Sitecore project up and running. However, I would like to include some simple configuration values on AppSetting of web.config file. From what I read it's not good practice to mess with Sitecore config file.
Could any one please suggest the best practice to add key value on appsettings?
Should it go under app_config?
If yes, then which folder and what naming convention should I use?
And how does Sitecore reads this file on runtime?
In my current project I've removed all app settings from the web.config and included them like so:
<appSettings configSource=".\App_Config\AppSettings.config" />
I then use SlowCheetah (Which can be downloaded here) to change the settings in the AppSettings.config file if I have environment specific settings.
All changes to the sitecore section of the web.config I add through the include files. You can read more on include files in this post by John West

IIS isn't serving javascript and css requests on azure webrole application

need your help with this one, i'm running azure deployment on my localhost and get the webpage without css and javascript, when i look in fiddler i see 500 status and the following error: "It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS" on each request for javascript or css file, i already enabled static content on windows feature and it didn't help, i'm using iis 7.5 on windows professional 64 bit with azure sdk 1.7, tried anything, and nothing helped, can't change the site to web application cause the website only exist on iis while i'm running debug, any idea what to do?
Could it be that the directory from which you're serving JS/CSS files contains a web.config file? If this is the case this will be causing the problem.
Your web.config contains an element which can only be defined in a real web application (in the root of your application for example- or in the machine.config. To fix this issue you'll need to open the machine.config (C:\Windows\Microsoft.Net\Framework\v4.0.30319\Config\machine.config) and look at each configSection defined here that is also included in your web.config (in the folder containing the JS/CSS files).
If the configSection in the machine.config contains the allowDefinition attribute with MachineToApplication as value this means you cannot use that configSection in a web.config that isn't located in a web application. Meaning in your case you'll need to remove that configSection from the web.config in the folder containing the JS/CSS files.
If you're using ASP.NET MVC this is probably your Content folder.

Prevent IIS7/ASP.NET locking directory with images

I have an ASP.NET webapp using the ASP.NET MVC 2 framework. It allows users to upload files to an uploads folder. The issue occurs when an image within a sub-folder is accessed by a web browser:
http://mywebapp/uploads/image_gallery/sub_folder/image.jpg
The uploads folder is static and can't be modified by users, but anything below it is intended to be modifiable.
In the above example, the image_gallery folder becomes locked because w3wp.exe appears to create a handle on the sub_folder directory (using process explorer by sysinternals). I am still able to rename the sub_folder directory and the handle seems to stay with it after a rename, but i can't rename the parent folder (image_gallery in this case).
I can still browse within the folder and view other images and files etc. But can't rename the parent folder.
As this is using the MVC 2 framework i've put in an exclusion for the uploads folder like so:
routes.IgnoreRoute("upload/{*pathInfo}");
into global.asax, so i'm assuming that ASP.NET is serving up those images directly (outside of the MVC framework)
So I guess my question is, is there any way to prevent IIS from putting a handle on specific directories or forcing it to remove a handle? Is the MVC 2 framework doing something tricky even though i have the ignoreroute specified?
Thanks in advance for any tips!
I had the same problem, and after much investigating I've found the culprit:
Web.config
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
Setting this option (which makes all http modules run on ALL files, static ones included) to false fixed it for me.
I believe, directory handle gets created in worker processor because ASP.NET typically watches the file system for changes - this allows it to respond to change/addition of config files, new dlls etc.
I suggest that you move from the concept that users can control physical directory structure on the web server. Typically, what user can create is an logical directory structure but physical structure would be controlled by your program logic. Your logic will store the logical structure created by user and its mapping with actual physical structure on the web server.

MVC application deployed to IIS5 using Wildcard mapping causes 401 and 404 errors on CSS and JS

I've been developing an MVC 2 application under the built in Web-server in VS2010. On Friday, I moved it to a virtual directory under IIS 5 in my WinXP development machine. I had the usual problems, and added a wildcard mapping to the Virtual Directory configuration in IIS to map .* to aspnet_isapi.dll (Framework 4). Neither the check file exists box nor the Script Engine box is checked.
The routing works and brings up the correct page. But none of the css or js files are served. Fiddler shows them getting either 401 (Not Authorized) or 404 (Not Found) errors (with no apparent rhyme or reason to which one - sometimes both). I went back in and added IgnoreRoute statements to the mapping tables for .css and .js, files, but that made no difference. I also added LOCALMACHINE\ASPNET to the security settings on the directory, giving it (for right now) full control permissions (I know that's a security hole, but I'll fix it after I get it running.)
I have not seen this problem referred to in any of the blog posts on getting MVC running on pre-IIS 7 servers. Has anyone else seen it, and how did you solve it?
The simplest and most straightforward way I've found to get the scripts/graphics/css files working is to specifically remove the wildcard mapping to aspnet_isapi for your content directories (graphics, scripts, css), in the same way that you added them for the project directory.
Right click on your scripts folder and select properties, and hit Create. The configuration button will now be available; click it and hit Remove to remove the custom mapping that the folder inherited from it's parent; click okay. Now back in the properties dialog for the folder, click Remove, so it's no longer a virtual directory, and click OK. Repeat for other such folders.
This is because when your app servers url like : www.domain.com/Controller/Param1/Param2/Param3 it will try to get images from www.domain.com/Controller/Param1/Param2/Param3/images. Try to install firebug and see the net section. Good fix to this is use a helper method to add css reference that adds fully qualified path for css reference like: www.mydomain.com/css/my_css.css

Resources