我想在里面使用SquishIt nuget包和Windows Azure上运行的MVC3应用程序。我使用SquishIt来组合和缩小CSS和JS。
在my Views/Shares/_Layout.cshtml中,我有以下几行:
@MvcHtmlString.Create(
Bundle
.Css()
.Add("~/Content/templates/style.css")
.Add("~/Content/market.css")
.Add("~/Content/jquery-ui-theme/jquery-ui-1.8.17.custom.css")
.ForceRelease()
.Render("/Cache/combined-css_#.css"))这会导致一个
"System.IO.IOException: Unable to open file"我在这里找到了一些东西,http://www.bondigeek.com/blog/2011/03/22/all-is-quiet-not-on-the-azure-front/,但这实际上不是我想要的。一般来说,SquishIt应该可以在Azure VM的磁盘上写入,但可能是目录错误或安全权限不足。有什么想法吗?
发布于 2012-04-22 02:40:21
在Azure VM中,您不能直接写入文件系统。您必须配置SquishIt以将包保存在内存中。
有关更多详细信息,请参阅此页面:Using SquishIt programmatically without the file system
发布于 2012-11-18 00:54:30
你可以在azure上使用它,但你需要在web角色中添加一个启动脚本,该脚本将在你写入的目录上设置适当的权限:
以下是步骤:
将新文件夹添加到web项目中,我更喜欢将其命名为名为enableWritePermissions.cmd
icacls %~dp0..\scripts /grant "NETWORK SERVICE":(OI)(CI)RX <Startup> <Task commandLine="App_Startup\enableWritePermissions.cmd" executionContext="elevated" taskType="background" /> </Startup> 中添加Azure项目的ServiceDefinition.csdef,将启动脚本添加到web角色
这就是全部,您在\scripts目录中有一个写权限,您可以自由地使用最小化。
https://stackoverflow.com/questions/9132379
复制相似问题