【问题标题】:Telerik "Live Demos" solution - connection strings & database setupTelerik“现场演示”解决方案 - 连接字符串和数据库设置
【发布时间】:2023-04-01 17:25:01
【问题描述】:

寻找之前为 ASP.NET AJAX Live Demos 项目设置 Telerik Rad Controls 的人...我最近下载了用于 ASP.NET AJAX 框架的 Telerik Rad Controls。我正在使用大约 5-6 年前的 Telerik Rad Controls for ASP.NET(非 AJAX)框架将我们公司的一些代码升级到新的 AJAX 框架。许多旧控件在最新的浏览器版本(Google Chrome 12、Mozilla Firefox、Internet Explorer)中不起作用。某些控件在某些浏览器中有效,但在其他浏览器中无效,有时它并不总是与它发生故障的浏览器相同。

我已尽我所能解决我们公司框架中的现有问题,但我们仍有一些遗留问题,这些问题之前由我作为问题发布。这些就是我要解决的问题。于是我开始安装演示项目。

我们公司还没有使用 Visual Studio 2010,所以昨天我将 Telerik Live Demos 项目降级为 Visual Studio 2008。我通过进行 3 次更改手动转换了 *.sln 文件。幸运的是,没有 .csproj/.vbproj 文件(显然,因为他们的网站项目中有两种语言)。然后我将 .NET 版本从 4.0 更改为 3.5,对网站 bin 文件夹进行了必要的 Bin35 更新,在项目中删除了 4 个不同的 .NET 4.0 dll,并使用这些程序集卸载了任何文件,在 IIS 7 中进行了必要的更改,编译解决方案,一切都很好......

直到我尝试查看一些控件。然后我发现他们有 2 个数据库(Northwind 和 Telerik),您需要下载(.mdf/.ldf 文件)并附加到 SQL Server 2008。我今天这样做了,更新了连接字符串,但我'我仍然有一个问题。我希望这是我需要解决的许多问题中的最后一个,这样我才能理解框架。

仅供参考:我现在使用 web.config.35 文件作为我的“web.config”文件。我还将解决方案/项目的 .NET 版本从 2.0 更改为 3.5。这个可以吗?我认为这是因为 2.0 dll 在 3.5 站点中仍然可以正常运行.. 因为它仍然是 2.0 架构。

有人可以向我解释所有这些连接字符串的用途和必要的设置吗?我将 *.mdf 和 *.ldf 文件附加到 SQL Server,但它们仍处于集成模式(用于访问)。我还重命名了数据库...在附加和添加 *.mdf 文件后,数据库名称真的很长!

web.config 连接字符串:

    <connectionStrings>
        <add name="NorthwindConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|Northwind.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
        <add name="TelerikConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|Telerik.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
        <add name="NorthwindConnectionString35" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|Northwind.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
        <add name="TelerikConnectionString35" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|Telerik.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
        <add name="NorthwindEntities" connectionString="metadata=res://*;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Northwind.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
        <add name="TelerikEntities" connectionString="metadata=res://*;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Telerik.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
        <add name="QSFRatingsConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|QSFRatings.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
        <add name="SelfReferencingDbConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|TelerikSelfReferencingDb.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
    </connectionStrings>

在 Live Demos 中查看 ComboBox 控件时仍然出现此错误(运行 Live Demos 网站时):

Server Error in '/' Application.
--------------------------------------------------------------------------------

Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed. 
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.Data.SqlClient.SqlException: Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.

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.  

Stack Trace: 


[SqlException (0x80131904): Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.]
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4849015
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2394
   System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +35
   System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +144
   System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +342
   System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +221
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +4863459
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +31
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +433
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +499
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +65
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
   System.Data.SqlClient.SqlConnection.Open() +122
   System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +31
   System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +112
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +287
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +92
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1297
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +19
   Telerik.Web.UI.RadComboBox.OnDataBinding(EventArgs e) +635
   Telerik.Web.UI.RadComboBox.PerformSelect() +21
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
   Telerik.Web.UI.RadComboBox.DataBind() +37
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
   System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +22
   Telerik.Web.UI.RadComboBox.OnPreRender(EventArgs e) +15
   System.Web.UI.Control.PreRenderRecursiveInternal() +80
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.4961; ASP.NET Version:2.0.50727.4955 

【问题讨论】:

    标签: c# asp.net visual-studio-2008 telerik rad-controls


    【解决方案1】:

    假设您拥有允许您的 APP 将 .mdf 文件附加到 SQL 服务器的管理员凭据,请设置 User Instance = false(编辑:在您的连接字符串中将其更改为 false)。

    我认为这就是您当前遇到上述错误的原因。并不是说这会完全解决您的所有问题,但它应该可以帮助您解决该错误。

    -希望有帮助 -J

    【讨论】:

    • 基于这个问题发布了一个新问题。因为这并没有完全解决我的问题。 stackoverflow.com/questions/7366295/…
    • 在这里回复,所以我不会阻塞那个新帖子,但是您提到您在 SQL Server 下以“网络服务”用户身份登录。您是否尝试过使用本地系统(在 SQL Server 属性选项卡中的登录选项卡下)?如果是,结果如何?
    • 绝对......让我检查一下错误是什么(如果我记得......同样的错误)
    • 是的,同样的错误.. 看起来您对 Rad Controls 了解不少。如果您需要我向您展示有关我的设置的更多信息,请告诉我
    • 是的,自从我进入当前职位以来,我所有的应用程序/网站都在使用 Telerik 控件。不利的一面是,它并不总是控件错误,而是 IIS 或 SQL 中的一些愚蠢设置。您可以访问您工作的任何类型的聊天(谷歌聊天或任何东西?)软件?可能会更容易提供帮助。
    猜你喜欢
    • 2015-08-25
    • 1970-01-01
    • 2013-02-07
    • 1970-01-01
    • 2020-03-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多