简体   繁体   English

找不到我的数据库文件和连接字符串所在的位置?

[英]Unable to find where my database file and connection string is located?

i downloaded a demo application from http://code.msdn.microsoft.com/Authorization-based-aa2c0185/view/SourceCode 我从http://code.msdn.microsoft.com/Authorization-based-aa2c0185/view/SourceCode下载了演示应用程序

I run it on my Visual Studio and all worked fine. 我在Visual Studio上运行它,一切正常。 There is a database ASPNETDB.MDF in its App_Data folder which is used to store the user information or retrieve information for login purpose. App_Data文件夹中有一个数据库ASPNETDB.MDF ,该数据库用于存储用户信息或检索信息以用于登录。

Now what I want is to change this database with another database in my SQL Server. 现在,我想用我的SQL Server中的另一个数据库更改此数据库。

For that there can be two ways : 为此,可以有两种方法:

  • Locate the connection string etc. for ASPNETDB and change them with my own database. 找到ASPNETDB的连接字符串等,并使用我自己的数据库进行更改。

  • or add this ASPNETDB file to SQL Server by attaching. 或通过附加将该ASPNETDB文件添加到SQL Server。 But its showing error while attaching it. 但是在附加时显示错误。

Also if I exclude App_Data folder from project...Then even it works... 另外如果我从项目中排除App_Data文件夹...那么它甚至可以工作...

Where can find connection string for DB? 在哪里可以找到DB的连接字符串? I want to change the DB with mine own ? 我想用自己的数据库更改数据库吗?

Please Help 请帮忙

Thanks 谢谢

它使用来自machine.config的默认连接字符串:

<add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated  Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>

Go to the Web.debug.config file. 转到Web.debug.config文件。 There you will find comments noting how to wire up your config file. 在这里,您会发现注释,说明如何连接配置文件。 This will use config transforms so that when you build in debug mode, it will change your config file to override the machine defaults (which is what it is currently using). 这将使用配置转换,以便在调试模式下构建时,它将更改您的配置文件以覆盖计算机的默认值(这是当前使用的默认值)。 Just follow the comments and you should be good :) 只要按照评论,你应该很好:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到连接字符串 - Unable to find connection string SQL连接字符串到我的mdf数据库文件 - Sql Connection string to my mdf database file EntityFramework在哪里获得到本地数据库的连接字符串? - Where does EntityFramework get the connection string to my local database? 多数据库连接字符串:将其存储在我的应用程序中的位置 - Multi-database connection string: where store it in my application 我无法使用连接字符串连接数据库 - I am unable to connect my database in the connection string 我应该在哪里放置我的数据库连接字符串以及如何处理连接池? - Where should I place my database connection string and how do I handle connection pooling? 如何在数据库中的连接字符串处触发迁移 - How to fire migration where connection string is in database 检测换行符在字符串中的位置: - Detecting where a newline is located in a string: 我在哪里可以找到我的连接字符串以在 C# 应用程序中自动化 SAP? - Where I find my Connection String to automate SAP through in C# application? 找不到 Windows Forms App (.NET Core) 模板。 它位于哪里? - Unable to find Windows Forms App (.NET Core) Template. Where is it located?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM