試著將Silverlight與WCF部署到IIS6上,發現眉眉角角的東西還真多。

首先IIS會抱怨找不到xap檔案,這是因為IIS6的MIME Type中沒有宣告這些附檔名的緣故: (IIS6對未宣告的不認識檔案類型,一律會假裝沒看到,這是安全上的考量)

* .xap     application/x-silverlight-app
* .xaml    application/xaml+xml
* .xbap    application/x-ms-xbap

Silverlight UI出現了,但接著是.svc的檔案傳回找不到的訊息,也是需要註冊手續:servicemodelreg -i,幸好以前經歷過,很快就處理掉。

接著svc傳來以下錯誤:

Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.

依照網路上找到的資料,在IIS6中將svc檔案設為允許匿名存取,但仍無效。想到會不會是檔案權限影響? 果然,該目錄只放到Users讀取的程式,將檔案的NTFS權限開放NETWORK SERVICE帳號讀取,總算,Silverlight在IIS6的網站上活了起來。


Comments

# by Tim

您好, 我在silverlight專案中試著加入web reference時會出現如下錯誤,找了很多實在找不到什麼解決方法(多辦是叫你framework 3.5 sp1重灌),請問您有遇過嗎?另我已執行過servicemodelreg -i Could not load type 'System.ServiceModel.FaultImportOptions' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKey Token=b77a5c561934e089' OS: Vista Ultimate tools: VS2008, IIS7 Tim fang502539@gmail.com

# by Jeffrey

to Tim, 這問題我沒有遇到,直覺上我也認為跟.NET 3.5 SP1安裝有關.... 有沒有試過重新安裝VS2008 SP1?

# by frankie

可以請教 siverlight 跟 WPF 的不同點是 ? WCF 是什麼 ? 為何根 siverlight 相關聯 ? 簡單說明之,謝謝 ~ frankieyam1@gmail.com

# by Tim

framework and silverlight都重灌過了還是不行,真的是難啊!!還是感謝你的回覆

# by tony

未能加载文件或程序集“System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”或它的某一个依赖项。系统找不到指定的文件。

Post a comment