Chr*_*isF 9 c# silverlight connection-string wcf-ria-services
我们正在编写一个多租户的Silverlight应用程序.用户使用Windows窗体身份验证登录,我们从表中提取该用户的连接字符串.字符串的形式如下:
Data Source=1.2.3.4; Initial Catalog=database; Persist Security Info=True; User ID=######; Password=##########
Run Code Online (Sandbox Code Playgroud)
这工作正常.然后我们决定设置应用程序名称,因为这里列出的原因是个好主意:
Data Source=1.2.3.4; Initial Catalog=database; Application Name=application; Persist Security Info=True; User ID=######; Password=##########
Run Code Online (Sandbox Code Playgroud)
但是,现在没有建立连接,所以我们遇到了错误.这仅在部署的站点上失败.通过Visual Studio运行显然不受影响.进行连接的代码没有任何变化.我愿意相信应该有变化,但我无法弄清楚它们应该是什么.
正在创建连接如下:
public class OurDataContext : DataContext
{
public OurDataContext()
: base(SessionCache.OurConnectionString)
{
....
}
}
Run Code Online (Sandbox Code Playgroud)
SessionCache.OurConnectionString 是从数据库中读取的字符串.
UPDATE
连接字符串的更改可能是红色鲱鱼.我们只在一台Web服务器上遇到此故障(我无法直接访问该服务器).添加属性,通过另一台Web服务器所引用的数据库(即我做访问)不会重现该问题.这使我得出结论,错误在其他地方.但是,我仍然没有接近解决这个问题.
实际错误是一个例外:
An exception of type 'System.ServiceModel.DomainServices.Client.DomainOperationException' occurred and was caught.
------------------------------------------------------------------------------------------------------------------
01/31/2012 14:18:53
Type : System.ServiceModel.DomainServices.Client.DomainOperationException, System.ServiceModel.DomainServices.Client, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Message : Load operation failed for query 'GetUserSecurityConfig'. The remote server returned an error: NotFound.
Status : ServerError
ErrorCode : 0
Data : System.Collections.ListDictionaryInternal
Stack Trace : The stack trace is unavailable.
Run Code Online (Sandbox Code Playgroud)
我今天所做的所有研究都返回了一些不应该改变的相当基本的东西:
结果发现该问题是由于服务器上安装的 RIA 服务版本造成的。
我们最近更改了项目,通过 NuGet 包管理器包含 RIA 服务,并且该服务器已经安装了 VS2010 的 RIA 服务。当我们解决这个问题时,一切都恢复了生机。
目前还不清楚为什么这个问题花了这么长时间才显现出来。