2010-04-04 106 views
1

我一直在構建Silverlight應用程序和WCF服務一段時間,最近試圖在IIS7中託管它們。IIS7 + WCF + Silverlight問題

我在Windows Server 2008 R2上安裝了IIS7,並將這兩個應用程序添加到我的默認網站。我有一些問題,所以我希望你們中的一個人可以幫忙...

1)Silverlight和WCF服務應用程序不能使用傳遞身份驗證。在設置應用程序時,我需要「連接成」管理員服務器帳戶。我在網上閱讀時,您應該只需要在連接到另一臺計算機時使用「connect as」字段。如果我不提供管理員憑據,我得到這個錯誤。我必須在其他地方設置權限嗎?

HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid. Detailed Error Information Module IIS Web Core Notification BeginRequest Handler Not yet determined Error Code 0x80070005 Config Error Cannot read configuration file due to insufficient permissions Config File \?\C:\Users\Administrator\Documents\My Dropbox\Research Masters\Project\WCFService\Website\web.config Requested URL http:://localhost:80/WCFService/Service.svc Physical Path C:\Users\Administrator\Documents\My Dropbox\Research Masters\Project\WCFService\Website\Service.svc Logon Method Not yet determined Logon User Not yet determined Config Source -1: 0: Links and More Information This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the event logs may contain more information about what caused this error.

2)Visual Studio生成2個網頁來運行我的Silverlight應用程序(.html和.aspx)。當我運行Silverlight應用程序(以管理員身份連接)時,我可以導航到.html頁面,沒問題。當我嘗試打開.aspx文件我得到以下錯誤

Server Error in '/Platform' Application.

Access is denied.

Description: An error occurred while accessing the resources required to serve this request. You might not have permission to view the requested resources.

Error message 401.3: You do not have permission to view this directory or page using the credentials you supplied (access denied due to Access Control Lists). Ask the Web server's administrator to give you access to 'C:\Users\Administrator\Documents\My Dropbox\Research Masters\Project\Platform\Website\PlatformTestPage.aspx'.

Version Information: Microsoft .NET Framework Version:4.0.30128; ASP.NET Version:4.0.30128.1

3)WCF服務運行正常(同樣,作爲連接管理),直到我重新啓動服務器。當我嘗試在重新啓動後運行WCF服務時,似乎從解決方案中缺少了mysql程序集。如果我只是重建解決方案並再次運行該服務......它的工作原理(直到下一次重新啓動)。什麼導致這個錯誤?這裏

解決方案 - http://tinypic.com/view.php?pic=5yasqx&s=5

Server Error in '/WCFService' Application.

Could not load file or assembly 'MySql.Data, Version=6.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. Access is denied.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'MySql.Data, Version=6.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. Access is denied.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'MySql.Data, Version=6.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' could not be loaded.

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Stack Trace:

[FileLoadException: Could not load file or assembly 'MySql.Data, Version=6.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. Access is denied.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +567
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +192 System.Reflection.Assembly.Load(String assemblyString) +35
System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +243
System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +1423
System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +50
System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +1132

[ServiceActivationException: The service '/WCFService/Service.svc' cannot be activated due to an exception during compilation. The exception message is: Could not load file or assembly 'MySql.Data, Version=6.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. Access is denied..]
System.Runtime.AsyncResult.End(IAsyncResult result) +889824
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +179150
System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +107

Version Information: Microsoft .NET Framework Version:4.0.30128; ASP.NET Version:4.0.30128.1

僅此而已,希望有人讀這條消息,我浪費了大部分的週末試圖解決我自己這些問題...感謝

+0

這是我第一次使用IIS7,所以目前這對我來說都是新的,所以我不知道如何正確設置服務器,我只是在學習。前兩個似乎被拒絕訪問。我該如何解決? – Eanna 2010-04-04 14:55:35

回答

-3

你切不可能夠使用IIS7託管silverlight應用程序。 嘗試使用php/html腳本在apache服務器上託管您的silverlight應用程序。

希望幫助隊友 請評價我的回答

Anzwerx

1

我的建議:

1)檢查你的web應用程序文件夾的權限。您應該編輯Web應用程序文件夾的權限,以便IIS用戶可以從該文件夾讀取。 因此,您應該在Windows資源管理器中打開文件夾的文件夾屬性對話框,並檢查應用程序池用戶是否至少具有讀取權限。如果您沒有爲應用程序池提供其他用戶,則默認用戶應爲IIS_IUSRS。

2)檢查asp.net通過運行在你的系統中啓用:

如果您有.NET 4.0安裝在系統: 「%WINDIR%\ Microsoft.NET \框架\ v4.0.30319 \ ASPNET_REGIIS.EXE」 -i 否則: 「%WINDIR%\ Microsoft.NET \框架\ V2.0.50727 \ ASPNET_REGIIS.EXE」 -i

上面的命令將註冊/修復您的.NET安裝與IIS。

3)您的mysql dll是否位於bin文件夾中?我會檢查你是否也有權限閱讀這個文件夾。如果該dll與您的應用程序dll不在同一個文件夾中,請檢查該dll是否安裝在GAC中。

Regards,

+0

所以,當你說文件夾上的「編輯權限」時,你的意思是通過Windows資源管理器,屬性,安全選項卡並添加ISS用戶(我能找到的最接近的東西是ISS_IUSRS--對嗎?)。如果你必須在IIS管理器中做一些事情,你可以更具體一些。我剛開始使用IIS,不知道我在做什麼。關於你的mysql的答案。 mysql.dll文件位於項目中引用的WCF服務庫目錄中,並在編譯後複製到bin文件夾中。當我編譯WCF服務網站時,它會導入mysql.dll和library.dll文件 – Eanna 2010-04-05 16:18:18

+0

我的意思是使用Windows資源管理器編輯權限,並檢查應用程序池的用戶是否具有讀取權限。如果您沒有更改用戶,則默認應爲IIS_IUSRS。 – 2011-10-19 13:16:38

0

1)授予IIS_IUSRS組文件夾的權限。 另請參閱IIS管理器 - >「應用程序池」中的應用程序的應用程序池是否將Identity設置爲「LocalSystem」。對我而言,它是「NetworkService」,將其設置爲「LocalSystem」解決了它。