2012-07-23 78 views
0

CSS不能在IIS 7.5上使用Helicon Zoo和Sinatra正常工作。Helicon Zoo Sinatra静态文件

这里是目录结构:

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 

我从Helicon Zoo's Sinatra page复制的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> 

任何想法?

回答

1

我们忘了在/ public文件夹中包含web.config示例,对不起。你可以看到这个例子中,页面Ruby on Rails的安装位置上:Ruby on Rails (2.3.x and 3.x.x) on IIS 请把这个web.config文件到/公用文件夹:

<?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> 
+0

这工作......但我不得不改变“删除名字“部分从rails.project到sinatra.project。谢谢! – 2012-07-23 18:09:45