web.config文件中设置的数据库路径。 (主机) [英] Database path set in web.config file. (Hosting)
本文介绍了web.config文件中设置的数据库路径。 (主机)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
i尝试在web.config文件中设置数据库路径。
i am使用文件zilla上传文件。
App_data文件夹中的数据库文件。
i使用以下代码:
hi there,
i try to set database path in web.config file.
i am using file zilla for upload files.
Database file in App_data folder.
i used following code:
<add name="conn" connectionstring="Data Source=localhost;Initial Catalog=|DataDirectory|\KesariyaData.mdf;pooling='true';Integrated Security=True;User Instance=True" />
以上代码显示错误。
由于无法检索用户的本地应用程序数据路径,无法生成SQL Server的用户实例。请确保用户在计算机上具有本地用户配置文件。连接将被关闭。
Above code display error.
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.
推荐答案
检查这些链接,问题将与其中一个相关,相应地更改您的配置。
http://stackoverflow.com/questions/4770596/failed-to-generate-a-user-instance-of-sql-server-due-to-failure-in-retrieving-th [ ^ ]
http://stackoverflow.com/questions/6293765/failed-to-generate-a- user-of-sql-server-due-to-failure-in-retrieval-th [ ^ ]
http://stackoverflow.com/questions/526745/how-can-i-create-a-local-user-profile-for-the-anonymous-user-of-an-asp- net-mvc -a [ ^ ]
Check these links and the issue will related to one of these, change your config accordingly.
http://stackoverflow.com/questions/4770596/failed-to-generate-a-user-instance-of-sql-server-due-to-failure-in-retrieving-th[^]
http://stackoverflow.com/questions/6293765/failed-to-generate-a-user-instance-of-sql-server-due-to-failure-in-retrieving-th[^]
http://stackoverflow.com/questions/526745/how-can-i-create-a-local-user-profile-for-the-anonymous-user-of-an-asp-net-mvc-a[^]
This might be helpful for you..
<connectionstrings>
<add name="conn" connectionstring="Data Surce=|DataDirectory|KesariyaData.sdf">
providerName="System.Data.SqlServerCe.4.0"/>
</add></connectionstrings>
在Web.config中
In Web.config
<add name="irtConnString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" providerName="System.Data.OleDb"/>
代码:
Code:
<pre>string connectionString = ConfigurationManager.ConnectionStrings["irtConnString"].ConnectionString + Server.MapPath("/your/application/path/irtDB.mdb");
这篇关于web.config文件中设置的数据库路径。 (主机)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文