如何将.mdf数据库文件发布到asp.net网站。 [英] How to publish .mdf database file into a asp.net web site.
问题描述
我设计了一个asp.net网站。我的App_data文件夹包含db.mdf(和db_log.ldf)文件,该文件在localhost中正常工作。但是进入Web服务器它不起作用。在网站上我使用gridview从db.mdf文件访问数据。这是我的第一个asp.net网站。请有人帮我发布我的数据库(app_data)。
我使用的是我在本地主机上使用的相同连接字符串
< pre lang =xml> < connectionStrings >
< add 名称 = BBAConnectionString1 connectionString = 数据源=(LocalDB)\ v11.0; AttachDbFilename = | DataDirectory | \ BBA.mdf; Integrated Security = True providerName = System.Data.SqlClient / >
< / connectionStrings >
按照步骤说明将数据库部署到服务器
http://www.asp.net/web-forms/tutorials/deployment/deploying-web-site- projects / deployloying-a-database-cs [ ^ ]
希望这有助于
I have design an asp.net web site. My App_data folder contain db.mdf(and db_log.ldf) file which work fine in localhost. But into the web server it does not work. In the web site I am using gridview that access data from db.mdf file. This is my first asp.net web site. Please someone help me to publish my database(app_data).
I am using same Connection String that I used in my local host
<connectionStrings>
<add name="BBAConnectionString1" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\BBA.mdf;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
Follow the step by step instructions for the DB deployment to the server
http://www.asp.net/web-forms/tutorials/deployment/deploying-web-site-projects/deploying-a-database-cs[^]
Hope this helps
这篇关于如何将.mdf数据库文件发布到asp.net网站。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!