2011-09-08 48 views
1

我是新开发的Silverlight应用程序,部署应用程序后出现数据库连接问题(我可以访问应用程序,但我无法登录由于数据库问题)。在IIS 5.1上部署Silverlight 4应用程序时发生数据库连接问题

下面是我的错误信息

 
Unhandled Error in Silverlight Application Load operation failed for query 'Login'. The remote server returned an error: NotFound. 
    at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error) 
    at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.End(IAsyncResult result) 
    at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.c__DisplayClass1.b__0(Object state) 
    at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.RunInSynchronizationContext(SendOrPostCallback callback, Object state) 
    at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.HandleAsyncCompleted(IAsyncResult asyncResult) 
    at System.ServiceModel.DomainServices.Client.AsyncResultBase.Complete() 
    at System.ServiceModel.DomainServices.Client.ApplicationServices.WebAuthenticationService.HandleOperationComplete(OperationBase operation) 
    at System.ServiceModel.DomainServices.Client.LoadOperation.c__DisplayClass4`1.b__0(LoadOperation`1 arg) 
    at System.ServiceModel.DomainServices.Client.LoadOperation`1.InvokeCompleteAction() 
    at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error) 
    at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error) 
    at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult) 
    at System.ServiceModel.DomainServices.Client.DomainContext.c__DisplayClass1b.b__17(Object) 

,这是我的连接字符串

<connectionStrings> 
    <remove name="LocalSqlServer" /> 
    <add name="LocalSqlServer" connectionString="server=.;data source=PC15\SQLEXPRESS;Initial Catalog=LodeSuiteDB;Integrated Security=True;" /> 
    <add name="LodeSuiteDB1Entities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=PC15\SQLEXPRESS;initial catalog=LodeSuiteDB;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /> 
</connectionStrings> 

有没有人有同样的问题?我为我的开发(在Windows 7上运行)使用Visual Studio 2010 Ultimate Edition和SQL Server 2008,而我的IIS服务器(IIS 5.1)在Windows XP Professional上运行

我一直在试图解决这个问题几天无济于事。非常感谢您的帮助!

回答

0

问题将出现在ComputerName/ASPNET帐户的标识下运行ASPNET_WP进程(它承载IIS5.1上的ASP.NET代码)。

由于您在连接字符串中使用集成安全性,因此帐户将需要被授予对正在访问的SQL数据库的访问权限。

或者,您需要在web.config中启用模拟并指定可以访问数据库的帐户的用户名和密码。

+0

感谢您的回复。我试过在我的SQL服务器设置中授予访问权限,并在我的连接字符串中指定了用户标识/密码信息,但我仍然遇到同样的错误。 顺便说一句,我可以连接到数据库,当我在调试模式下(在我的Visual Studio中按F5)没有问题。问题出现在我将它部署到我的IIS服务器之后(即使它位于我的本地主机中) – George

+0

@George:这种性质的所有问题中有99.9%取决于权限。在Visual Studio中运行时,开发Web服务器将在您的用户登录下运行。 IIS5.1使用的ASPNET_WP在ASPNET帐户下运行。您是否检查过在Visual Studio中的连接字符串中放置ID和密码?是否有其他资源被访问ASPNET帐户没有访问(ASPNET是本地帐户它不在域上)。 – AnthonyWJones

0

我不认为这是数据库连接问题。这里的问题看起来更像是Silverlight应用程序无法通过WCF RIA Services与应用程序服务器通信。看看使用Fiddler的一些RIA服务电话,看看是否有任何显示错误。

This link有关于如何解决RIA Services NotFound错误的更多帮助。