如何设置 web.config 数据库 ConnectionString 以从 WebMatrix 发布 DotNetNuke
文章在这里 :: http://www.microsoft .com/web/post/how-to-publish-a-web-application-using-webmatrix
指出要通过 FTP 发布,我必须“输入目标数据库的连接字符串”并给出示例。我不清楚是否必须替换当前的 web.config 字符串,或者是否要添加一个。我也不明白是否必须将一个数据库标记为目标数据库。
这是我到目前为止所拥有的。当我访问网站时,它显示“正在建设中”。了解如何使其脱离该状态以及打开日志错误将很有帮助。
<!-- this is the local connection -->
<add name="SiteSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|Database.mdf;" providerName="System.Data.SqlClient" />
<!-- this is the destination db -->
<add name="myConnectionStrings" connectionString="Server=205.xxx.xxx.xxx;Database=mydbname;uid=mydbusername;pwd=mydbpasswd;" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<!-- Connection String for SQL Server 2005/2008 Express - kept for backwards compatability - legacy modules -->
<add key="SiteSqlServer" value="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|Database.mdf;" />
.
.
.
</appSettings>
The article here
:: http://www.microsoft.com/web/post/how-to-publish-a-web-application-using-webmatrix
states that to publish via FTP I must "enter the connection string for the destination database" and gives examples. It is not clear to me if I have to replace the current web.config string, or if I'm adding one. I also don't understand if I have to mark one as a destination database.
Here is what I have thus far. When I visit website it says "under construction". It would be helpful to know how to get it out of that state, and also turn log error on.
<!-- this is the local connection -->
<add name="SiteSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|Database.mdf;" providerName="System.Data.SqlClient" />
<!-- this is the destination db -->
<add name="myConnectionStrings" connectionString="Server=205.xxx.xxx.xxx;Database=mydbname;uid=mydbusername;pwd=mydbpasswd;" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<!-- Connection String for SQL Server 2005/2008 Express - kept for backwards compatability - legacy modules -->
<add key="SiteSqlServer" value="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|Database.mdf;" />
.
.
.
</appSettings>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在 WebMatrix 上工作并找到了您的帖子,所以我想我应该提供一些答案:
我猜您看到“正在建设中”的原因是某些应用程序在其安装过程中包含一些站点创建后配置。对于 DotNetNuke,您似乎需要访问:
http://localhost:port/Install/InstallWizard。 aspx,
但如果需要,您可以在安装任何应用程序后随时单击功能区中的“运行”按钮来启动配置过程。
至于设置,但您的网站发布您不需要编辑 web.config 文件。在本教程中所示的 Bakery 应用程序中,我们使用基于文件的数据库,因此我们能够使用简单的文件副本通过 Web 部署和 FTP 轻松部署数据库。另一方面,DotNetNuke 使用完整的 SQL 数据库,因此我们无法通过 FTP 发布或下载数据库。无需在本地向您的应用程序输入任何其他连接字符串,但一旦 FTP 发布完成,您将负责更改服务器上 web.config 中的数据库连接字符串(以及可能已更改的其他设置,例如站点网址)。
由于 Web 部署不仅仅是一个文件复制协议,如果您选择 Web 部署作为发布方法,我们实际上能够同步您的本地和远程数据库。您需要在“发布设置”对话框中输入远程数据库服务器的连接字符串以及其他连接信息,并且可以使用“验证”按钮来测试这些设置。
要查看错误日志,您可以转到 WebMatrix 中的站点工作区,然后单击左侧导航中的请求。确保功能区中的“捕获请求”开关已打开。功能区中还提供了用于调整记录内容的其他选项。
希望有帮助,
安德鲁
I work on WebMatrix and found your post so I thought I'd provide some answers:
I'm guessing the reason you see "Under Construction" is some applications include some post-site creation configuration as part of their install. For DotNetNuke specifically it looks like you'll want to visit:
http://localhost:port/Install/InstallWizard.aspx
but you can always click the "Run" button from the ribbon after installing any app to start the configuration process if required.
As for setuping but your site publishing you shouldn't ever need to edit the web.config file. In Bakery application shown in the tutorial uses a file-based database so we're able to easily deploy the database through both Web Deploy and FTP using a simple file copy. DotNetNuke on the otherhand uses a full SQL database so we're not able to publish or download the database via FTP. There is no need to enter any additional connection strings to your app locally but you will be responsible for changing the database connection string in the web.config on the server once FTP publishing is done (as well as other settings that may have changed like the site url).
Since Web Deploy is more than just a file copying protocol if you choose Web Deploy as your publishing method we're able to actually sync your local and remote databases. You'll need to enter the connection string for the remote database server on the Publish Settings dialog along with your other connection information and you can use the Validate button to test those settings.
To view your error log you can go to the Site workspace in WebMatrix and then click on Requests in the left-hand navigation. Make sure the Capture Requests toggle in the ribbon is turned on. Additional options to tweak what is logged are also available in the ribbon.
Hope that helps,
Andrew