Whilst on my local machine the following code behaves perfectly.

@Html.Raw(SquishIt.Framework.Bundle.Css()
                                   .Add("~/css/normalize.css")
                                   .Add("~/css/nonsemantic.css")
                                   .Add("~/css/custom/basic/site.css")
                                   .ForceRelease()
                                   .Render("~/css/style.min.css"))

A new minified style.min.css file is created under the specified directory.

However, when I deploy my code to my hosting provider I get an UnauthorizedAccessException with the message of "Access to the path 'C:\...\style.min.css' is denied".

I don't think it is a problem with my SquishIt implementation, but I can't for the life of me figure this one out.

有帮助吗?

解决方案

You might need to use your hosting provider's file management tool to give the app pool identity write access to the folder SquishIt is trying to create style.min.css in. For an example of how this is done at one hosting provider, see Setting Folder Permissions for Elmah in this tutorial:

http://www.asp.net/web-forms/tutorials/deployment-to-a-hosting-provider/deployment-to-a-hosting-provider-deploying-to-the-production-environment-7-of-12

On your local machine do you run under IIS or using the Visual Studio Development Server (Cassini)? If it's a folder permission issue you'd see the same thing locally, as in the preceding tutorial from the same series:

http://www.asp.net/web-forms/tutorials/deployment-to-a-hosting-provider/deployment-to-a-hosting-provider-setting-folder-permissions-6-of-12

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top