2013-02-07 52 views
0

我創建了一個非常簡單的使用OpenLayers 2.12的ASP.NET 4.5 MVC4網站。它只有一個頁面顯示帶有幾個點和線的地圖。如果我在本地運行它,它運行良好,但在發佈到我的Azure網站後,OpenLayers的CSS文件將不會加載。我現在在我的bundleConfig中添加了硬編碼的OpenLayers CSS,現在它工作正常。但當然,這不是我想要的,因爲OpenLayers具有針對其他平臺和瀏覽器版本的特定CSS文件等。OpenLayers的CSS在發佈到Azure網站後發生故障

本地,我只需要包含openlayers.js和OpenLayers,然後添加正確的css文件。有人知道爲什麼在發佈到Azure後不起作用嗎?

回答

0

從openlayers.js文檔:

Please remember that when your OpenLayers script is not named 
"OpenLayers.js" you will have to make sure that the default theme is 
loaded into the page by including an appropriate <link>-tag, 
e.g.: 

(code) 
<link rel="stylesheet" href="/path/to/default/style.css" type="text/css"> 
(end code) 

由於Azure的變化所包含的文件名,我確實應該加入參考默認樣式自己。另外,我可以鏈接到style.css,其他的css文件例如IE6或手機將不會自動使用,這些只是適合您自己使用它。