Iis Helicon Zoo Sinatra静态文件
CSS在使用Helicon Zoo和Sinatra的IIS 7.5上无法正常工作 以下是目录结构:Iis Helicon Zoo Sinatra静态文件,iis,sinatra,Iis,Sinatra,CSS在使用Helicon Zoo和Sinatra的IIS 7.5上无法正常工作 以下是目录结构: welcometo --public --styles --welcometo.css 我用Webrick测试了我的网站,它运行得非常好 当我转到localhost:4567/styles/welcometo.css时,样式表将显示在web浏览器中 当我转到IIS站点/styles/welcometo.css时,我遇到以下错误: Try this: get '/public/styl
welcometo
--public
--styles
--welcometo.css
我用Webrick测试了我的网站,它运行得非常好
当我转到localhost:4567/styles/welcometo.css时,样式表将显示在web浏览器中
当我转到IIS站点/styles/welcometo.css时,我遇到以下错误:
Try this:
get '/public/styles/welcometo.css' do
"Hello World"
end
我从中复制了web.config。以下是静态文件部分:
<!-- Send static files through IIS -->
<rewrite>
<rules>
<rule name="Avoid Static Files" stopProcessing="true">
<match url="^(?!public)(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
<add input="{APPL_PHYSICAL_PATH}" pattern="(.*)" ignoreCase="false" />
<add input="{C:1}public\{R:1}" matchType="IsFile" />
</conditions>
<action type="Rewrite" url="public/{R:1}" />
</rule>
</rules>
</rewrite>
有什么想法吗?对不起,我们忘了包含/public文件夹的web.config示例。您可以在Ruby on Rails安装页面上看到以下示例: 请将此web.config文件放入/public文件夹:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<!--
This disables Helicon Zoo handler and makes IIS processing static
files directly.
-->
<remove name="rails.project#x64" />
<remove name="rails.project#x86" />
</handlers>
</system.webServer>
</configuration>
这是可行的……但我不得不将rails.project中的“删除名称”部分更改为sinatra.project。非常感谢。