2010-04-04 81 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”解决了它。